Package org.cyclos.model.utils
Enum TimeField
- java.lang.Object
-
- java.lang.Enum<TimeField>
-
- org.cyclos.model.utils.TimeField
-
- All Implemented Interfaces:
Serializable,Comparable<TimeField>,HasMessageKey
public enum TimeField extends Enum<TimeField> implements HasMessageKey
A given time field
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageKeygetMessageKey()Returns the message key for the plural formlonggetMilliseconds()Returns the number of milliseconds in this field.static EnumMessageKeyResolver<TimeField>resolverForAmount(Integer amount)Returns a resolver either for singular if the amount is 1 or for plural otherwisestatic EnumMessageKeyResolver<TimeField>resolverForPlural()static EnumMessageKeyResolver<TimeField>resolverForSingular()static TimeFieldvalueOf(String name)Returns the enum constant of this type with the specified name.static TimeField[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MILLIS
public static final TimeField MILLIS
-
SECONDS
public static final TimeField SECONDS
-
MINUTES
public static final TimeField MINUTES
-
HOURS
public static final TimeField HOURS
-
DAYS
public static final TimeField DAYS
-
WEEKS
public static final TimeField WEEKS
-
MONTHS
public static final TimeField MONTHS
-
YEARS
public static final TimeField YEARS
-
-
Method Detail
-
values
public static TimeField[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TimeField c : TimeField.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TimeField valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
resolverForAmount
public static EnumMessageKeyResolver<TimeField> resolverForAmount(Integer amount)
Returns a resolver either for singular if the amount is 1 or for plural otherwise
-
resolverForPlural
public static EnumMessageKeyResolver<TimeField> resolverForPlural()
-
resolverForSingular
public static EnumMessageKeyResolver<TimeField> resolverForSingular()
-
getMessageKey
public MessageKey getMessageKey()
Returns the message key for the plural form- Specified by:
getMessageKeyin interfaceHasMessageKey- See Also:
HasMessageKey.getMessageKey()
-
getMilliseconds
public long getMilliseconds()
Returns the number of milliseconds in this field. Only fields up to WEEKS are strictly correct. Greater fields, like MONTH, returns 30 days, and YEARS 365 days.
-
-