Enum DurationSettings.Resolution
- java.lang.Object
-
- java.lang.Enum<DurationSettings.Resolution>
-
- com.jalios.jcms.taglib.settings.impl.DurationSettings.Resolution
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<DurationSettings.Resolution>
- Enclosing class:
- DurationSettings
public static enum DurationSettings.Resolution extends java.lang.Enum<DurationSettings.Resolution>
Enumeration that lists the possible resolutions of a duration.- Author:
- ndossantos
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DurationSettings.Resolution
findBestResolution(long duration, DurationSettings.Resolution currentResolution, DurationSettings.Resolution maxResolution)
Try to find the bestDurationSettings.Resolution
from the given duration and its current Resolution.java.lang.String
getLabel()
Get the resolution label.static DurationSettings.Resolution
getResolution(java.lang.String resolution)
Resolve theDurationSettings.Resolution
from the given String representing one of the words or abbreviation associated with the resolution.long
getUnit()
Get the unit of time of the resolution in millisecondsstatic DurationSettings.Resolution
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static DurationSettings.Resolution[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MILLISECOND
public static final DurationSettings.Resolution MILLISECOND
-
SECOND
public static final DurationSettings.Resolution SECOND
-
MINUTE
public static final DurationSettings.Resolution MINUTE
-
HOUR
public static final DurationSettings.Resolution HOUR
-
DAY
public static final DurationSettings.Resolution DAY
-
WEEK
public static final DurationSettings.Resolution WEEK
-
MONTH
public static final DurationSettings.Resolution MONTH
-
YEAR
public static final DurationSettings.Resolution YEAR
-
-
Method Detail
-
values
public static DurationSettings.Resolution[] 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 (DurationSettings.Resolution c : DurationSettings.Resolution.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DurationSettings.Resolution valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getUnit
public long getUnit()
Get the unit of time of the resolution in milliseconds- Returns:
- unit of time in milliseconds
-
getLabel
public java.lang.String getLabel()
Get the resolution label.- Returns:
- label
-
getResolution
public static DurationSettings.Resolution getResolution(java.lang.String resolution)
Resolve theDurationSettings.Resolution
from the given String representing one of the words or abbreviation associated with the resolution.- Parameters:
resolution
- words or abbreviation associated with one of the resolutions- Returns:
DurationSettings.Resolution
object
-
findBestResolution
public static DurationSettings.Resolution findBestResolution(long duration, DurationSettings.Resolution currentResolution, DurationSettings.Resolution maxResolution)
Try to find the bestDurationSettings.Resolution
from the given duration and its current Resolution.- Parameters:
duration
- durationcurrentResolution
- Resolution of the durationmaxResolution
- the maximum resolution to be used- Returns:
DurationSettings.Resolution
object
-
-