Class DefaultContributionModel<C extends Contribution>
- java.lang.Object
-
- org.silverpeas.core.contribution.model.DefaultContributionModel<C>
-
- Type Parameters:
C
- the type of linkedContribution
instance.
- All Implemented Interfaces:
ContributionModel
- Direct Known Subclasses:
CalendarEventModel
,PublicationDetailModel
public class DefaultContributionModel<C extends Contribution> extends Object implements ContributionModel
The default implementation of theContributionModel
interface. In this implementation, the properties defined in the model are expected to be a declared property of the underlying concrete type of the modelled contribution and as such they are get by reflections.- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultContributionModel(C contribution)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilterByType
filterByType(String property, Object... parameters)
Applies a filter on the type of the value of the specified business property.protected <T> T
getByReflection(String property, Object... parameters)
Gets by reflection the value of the specified property of the underlying modelled contribution.protected C
getContribution()
Gets the linkedContribution
instance.<T> T
getProperty(String property, Object... parameters)
Gets the value of the specified business property.
-
-
-
Constructor Detail
-
DefaultContributionModel
protected DefaultContributionModel(C contribution)
-
-
Method Detail
-
filterByType
public FilterByType filterByType(String property, Object... parameters)
Description copied from interface:ContributionModel
Applies a filter on the type of the value of the specified business property. If the property value is null, then no filtering is applied.This method is useful to apply a specific treatment according to the type of the property (in the case the property can be of different type or the property represents a more generic business concept that can have different types according to the business context).
- Specified by:
filterByType
in interfaceContributionModel
- Parameters:
property
- the name of a business property of the represented contribution.parameters
- some parameters useful for property value computation.- Returns:
- a filter by the type of the property.
-
getProperty
public <T> T getProperty(String property, Object... parameters)
Description copied from interface:ContributionModel
Gets the value of the specified business property. The property can accept zero, one or more parameters.- Specified by:
getProperty
in interfaceContributionModel
- Type Parameters:
T
- the expected type of the property value.- Parameters:
property
- the name of the business property of the represented contribution.parameters
- optionally some parameters required to select the correct value of the property- Returns:
- the value of the asked business property.
-
getByReflection
protected <T> T getByReflection(String property, Object... parameters)
Gets by reflection the value of the specified property of the underlying modelled contribution.- Type Parameters:
T
- the type of the property value.- Parameters:
property
- the property to get.parameters
- some parameters useful for property value computation.- Returns:
- the value of the property
-
getContribution
protected C getContribution()
Gets the linkedContribution
instance.- Returns:
- a
Contribution
instance.
-
-