Enum TimeUnit
- java.lang.Object
-
- java.lang.Enum<TimeUnit>
-
- com.redwood.scheduler.api.model.enumeration.TimeUnit
-
- All Implemented Interfaces:
BaseSchedulerEnumeration<TimeUnit,Character>
,SchedulerEnumeration<TimeUnit>
,Serializable
,Comparable<TimeUnit>
public enum TimeUnit extends Enum<TimeUnit> implements SchedulerEnumeration<TimeUnit>
The unit of measure for a time interval. (Character Enumeration)
-
-
Field Summary
Fields Modifier and Type Field Description static char
DaysCode
The char returned from Days.getCodeEx().static char
HoursCode
The char returned from Hours.getCodeEx().static char
MinutesCode
The char returned from Minutes.getCodeEx().static char
MonthsCode
The char returned from Months.getCodeEx().static char
SecondsCode
The char returned from Seconds.getCodeEx().static char
YearsCode
The char returned from Years.getCodeEx().
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description char
getCodeEx()
Get the code that is used to represent this enumeration in the database.Character
getCodeExCharacter()
Get the code that is used to represent this enumeration in the database.String
getCodeExString()
Get the code that is used to represent this enumeration in the database.Character
getCodeExValue()
Return the code for the enumeration item as the database type of this enumeration.String
getDescriptionKey()
Get the translation-key for the description that must be used to retrieve the locale-specific description of this enumeration.String
getTranslationEN()
Get the English name of this enumeration.String
getTranslationKey()
Get the translation-key that must be used to retrieve the locale-specific name of this enumeration.static TimeUnit
safeValueOf(String value)
Helper function to return the TimeUnit represented byvalue
.static TimeUnit
valueOf(char code)
Helper function to return the TimeUnit represented by code.static TimeUnit
valueOf(Character code)
Helper function to return the TimeUnit represented by code.static TimeUnit
valueOf(String name)
Returns the enum constant of this type with the specified name.static TimeUnit
valueOfCode(String code)
Helper function to return the TimeUnit represented by code.static TimeUnit[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface com.redwood.scheduler.api.model.enumeration.BaseSchedulerEnumeration
name, ordinal
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Enum Constant Detail
-
Seconds
public static final TimeUnit Seconds
Seconds.
-
Minutes
public static final TimeUnit Minutes
Minutes.
-
Hours
public static final TimeUnit Hours
Hours.
-
Days
public static final TimeUnit Days
Days.
-
Months
public static final TimeUnit Months
Months.
-
Years
public static final TimeUnit Years
Years.
-
-
Field Detail
-
SecondsCode
public static final char SecondsCode
The char returned from Seconds.getCodeEx().- See Also:
Seconds
, Constant Field Values
-
MinutesCode
public static final char MinutesCode
The char returned from Minutes.getCodeEx().- See Also:
Minutes
, Constant Field Values
-
HoursCode
public static final char HoursCode
The char returned from Hours.getCodeEx().- See Also:
Hours
, Constant Field Values
-
DaysCode
public static final char DaysCode
The char returned from Days.getCodeEx().- See Also:
Days
, Constant Field Values
-
MonthsCode
public static final char MonthsCode
The char returned from Months.getCodeEx().- See Also:
Months
, Constant Field Values
-
YearsCode
public static final char YearsCode
The char returned from Years.getCodeEx().- See Also:
Years
, Constant Field Values
-
-
Method Detail
-
values
public static TimeUnit[] 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 (TimeUnit c : TimeUnit.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TimeUnit 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
-
valueOfCode
public static TimeUnit valueOfCode(String code)
Helper function to return the TimeUnit represented by code. code must be a single character. If code is null, longer than one character, empty, or not a valid code then this method will return null.- Parameters:
code
- A string with one character that is one of the codes for TimeUnit- Returns:
- The TimeUnit corresponding to code, or null, if code is null, longer than one character, or not a valid code
-
safeValueOf
public static TimeUnit safeValueOf(String value)
Helper function to return the TimeUnit represented byvalue
. Ifvalue
is null, or not a valid TimeUnit enumeration then this method will return null.The main difference between this method and
valueOf(String)
, is that this method will return null when passed an invalidvalue
,valueOf(String)
will throw anIllegalArgumentException
.- Parameters:
value
- The string value that corresponds to the requested enumeration value- Returns:
- The TimeUnit corresponding to
value
, or null, ifvalue
is null, or not a valid enumeration - See Also:
valueOf(String)
-
valueOf
public static TimeUnit valueOf(Character code)
Helper function to return the TimeUnit represented by code. If code is null, or not a valid TimeUnit code then this method will return null.- Parameters:
code
- Character that is one of the codes for HandlerAction- Returns:
- The TimeUnit corresponding to code, or null, if code is null, or not a valid code
-
valueOf
public static TimeUnit valueOf(char code)
Helper function to return the TimeUnit represented by code. If code is not a valid TimeUnit code then this method will return null.- Parameters:
code
- char that is one of the codes for HandlerAction- Returns:
- The TimeUnit corresponding to code, or null, if code is not a valid code
-
getCodeEx
public char getCodeEx()
Description copied from interface:SchedulerEnumeration
Get the code that is used to represent this enumeration in the database.- Specified by:
getCodeEx
in interfaceSchedulerEnumeration<TimeUnit>
- Returns:
- the database code for the enumeration
-
getCodeExValue
public Character getCodeExValue()
Description copied from interface:BaseSchedulerEnumeration
Return the code for the enumeration item as the database type of this enumeration.- Specified by:
getCodeExValue
in interfaceBaseSchedulerEnumeration<TimeUnit,Character>
- Returns:
- the enumeration code
-
getCodeExCharacter
public Character getCodeExCharacter()
Description copied from interface:SchedulerEnumeration
Get the code that is used to represent this enumeration in the database.- Specified by:
getCodeExCharacter
in interfaceSchedulerEnumeration<TimeUnit>
- Returns:
- the database code for the enumeration
-
getTranslationKey
public String getTranslationKey()
Description copied from interface:BaseSchedulerEnumeration
Get the translation-key that must be used to retrieve the locale-specific name of this enumeration.- Specified by:
getTranslationKey
in interfaceBaseSchedulerEnumeration<TimeUnit,Character>
- Returns:
- the key.
-
getTranslationEN
public String getTranslationEN()
Description copied from interface:BaseSchedulerEnumeration
Get the English name of this enumeration.- Specified by:
getTranslationEN
in interfaceBaseSchedulerEnumeration<TimeUnit,Character>
- Returns:
- the English name of this enumeration.
-
getDescriptionKey
public String getDescriptionKey()
Description copied from interface:BaseSchedulerEnumeration
Get the translation-key for the description that must be used to retrieve the locale-specific description of this enumeration.- Specified by:
getDescriptionKey
in interfaceBaseSchedulerEnumeration<TimeUnit,Character>
- Returns:
- the key that can be passed to
SchedulerSession.translateField(String)
to retrieve the translated description.
-
getCodeExString
public String getCodeExString()
Description copied from interface:SchedulerEnumeration
Get the code that is used to represent this enumeration in the database.- Specified by:
getCodeExString
in interfaceSchedulerEnumeration<TimeUnit>
- Returns:
- the database code for the enumeration
-
-