Class Period
- java.lang.Object
-
- org.alfresco.service.cmr.repository.Period
-
- All Implemented Interfaces:
Serializable
public class Period extends Object implements Serializable
Implementation for the period data type "d:period" A period is specified by the period type and an optional expression. The string value is periodType|expression Examples are: none day - one day day|3 - 3 days week - one week week|1 - one week week|2 - two weeks month year monthend quarterend The period type specifies a period implementation. This is registered with this class and is used to when adding the period to a date, handles any processing of the expression, reports if the expression is not required, optional or mandatory. The period data type can be also passed as a Map of keys: periodType and expression.- Author:
- andyh
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetExpression()DategetNextDate(Date date)Calculate the next date for this period given the a start date.StringgetPeriodType()static PeriodProvidergetProvider(String periodType)Find a providerstatic Set<String>getProviderNames()Get the set of registered providersinthashCode()static voidregisterProvider(PeriodProvider periodProvider)Register a providerStringtoString()
-
-
-
Method Detail
-
registerProvider
public static void registerProvider(PeriodProvider periodProvider)
Register a provider- Parameters:
periodProvider- PeriodProvider
-
getProvider
public static PeriodProvider getProvider(String periodType)
Find a provider- Parameters:
periodType- String- Returns:
- the provider
- Throws:
IllegalStateException- of there is no implementation
-
getProviderNames
public static Set<String> getProviderNames()
Get the set of registered providers- Returns:
- - the set of registered providers
-
getPeriodType
public String getPeriodType()
- Returns:
- the periodType
-
getExpression
public String getExpression()
- Returns:
- the expression
-
getNextDate
public Date getNextDate(Date date)
Calculate the next date for this period given the a start date.- Parameters:
date- Date- Returns:
- the next date.
-
-