Package adams.core
Enum BusinessDays
- java.lang.Object
-
- java.lang.Enum<BusinessDays>
-
- adams.core.BusinessDays
-
- All Implemented Interfaces:
EnumWithCustomDisplay<BusinessDays>
,EnumWithCustomParsing<BusinessDays>
,Serializable
,Comparable<BusinessDays>
public enum BusinessDays extends Enum<BusinessDays> implements EnumWithCustomDisplay<BusinessDays>
Enum for defining business days. See here: https://en.wikipedia.org/wiki/Workweek_and_weekend#Around_the_world
-
-
Enum Constant Summary
Enum Constants Enum Constant Description MONDAY_TO_FRIDAY
MONDAY_TO_SATURDAY
SATURDAY_TO_THURSDAY
SUNDAY_TO_FRIDAY
SUNDAY_TO_THURSDAY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isBusinessDay(Date d)
Checks whether the provided date represents a business day for this enum.BusinessDays
parse(String s)
Parses the given string and returns the associated enum.String
toDisplay()
Returns the display string.String
toRaw()
Returns the raw enum string.String
toString()
Returns the display string.static BusinessDays
valueOf(String name)
Returns the enum constant of this type with the specified name.static BusinessDays[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MONDAY_TO_FRIDAY
public static final BusinessDays MONDAY_TO_FRIDAY
-
MONDAY_TO_SATURDAY
public static final BusinessDays MONDAY_TO_SATURDAY
-
SATURDAY_TO_THURSDAY
public static final BusinessDays SATURDAY_TO_THURSDAY
-
SUNDAY_TO_THURSDAY
public static final BusinessDays SUNDAY_TO_THURSDAY
-
SUNDAY_TO_FRIDAY
public static final BusinessDays SUNDAY_TO_FRIDAY
-
-
Method Detail
-
values
public static BusinessDays[] 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 (BusinessDays c : BusinessDays.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BusinessDays 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
-
toDisplay
public String toDisplay()
Returns the display string.- Specified by:
toDisplay
in interfaceEnumWithCustomDisplay<BusinessDays>
- Returns:
- the display string
-
toRaw
public String toRaw()
Returns the raw enum string.- Specified by:
toRaw
in interfaceEnumWithCustomDisplay<BusinessDays>
- Returns:
- the raw enum string
-
toString
public String toString()
Returns the display string.- Overrides:
toString
in classEnum<BusinessDays>
- Returns:
- the display string
-
parse
public BusinessDays parse(String s)
Parses the given string and returns the associated enum.- Specified by:
parse
in interfaceEnumWithCustomParsing<BusinessDays>
- Parameters:
s
- the string to parse- Returns:
- the enum or null if not found
-
isBusinessDay
public boolean isBusinessDay(Date d)
Checks whether the provided date represents a business day for this enum.- Parameters:
d
- the date to check- Returns:
- true if a business day
-
-