Package org.pepstock.charba.client.intl
Class DateTimeFormatOptions
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.intl.DateTimeFormatOptions
-
- All Implemented Interfaces:
IsDefaultBaseFormatOptions
,IsDefaultDateTimeFormatOptions
public final class DateTimeFormatOptions extends NativeObjectContainer implements IsDefaultDateTimeFormatOptions
The object configures a date time formatter.
See MDN for more details.- Author:
- Andrea "Stock" Stocchero
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DateTimeFormatOptions.DateTimeFormatOptionsFactory
Creates a date time format options by a native object and a default values instance.
-
Field Summary
Fields Modifier and Type Field Description static DateTimeFormatOptions.DateTimeFormatOptionsFactory
FACTORY
Public factory to create a date time format options from a native object.
-
Constructor Summary
Constructors Constructor Description DateTimeFormatOptions()
Creates new number format options object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Calendar
getCalendar()
Returns the calendar to use.DateTimeStyle
getDateStyle()
Returns the date formatting style to use when callingAbstractFormat.format(java.lang.Object)
.NumberItemStyle
getDay()
Returns the representation of the Day.StringItemStyle
getDayPeriod()
Returns the way day periods should be expressed.protected D
getDefaultValues()
StringItemStyle
getEra()
Returns the representation of the Era.FormatMatcher
getFormatMatcher()
Returns the format matching algorithm to use.NumberItemStyle
getHour()
Returns the representation of the Hour.HourCycle
getHourCycle()
Returns the hour cycle to use.LocaleMatcher
getLocaleMatcher()
Returns the locale matching algorithm to use.NumberItemStyle
getMinute()
Returns the representation of the Minute.MixedItemStyle
getMonth()
Returns the representation of the Month.NumberingSystem
getNumberingSystem()
Returns the numbering system to use.NumberItemStyle
getSecond()
Returns the representation of the Second.DateTimeStyle
getTimeStyle()
Returns the time formatting style to use when callingAbstractFormat.format(java.lang.Object)
.TimeZone
getTimeZone()
Returns the time zone to use.TimeZoneName
getTimeZoneName()
Returns the representation of the time zone name.StringItemStyle
getWeekDay()
Returns the representation of the WeekDay.NumberItemStyle
getYear()
Returns the representation of the Year.boolean
isHour12()
Returns whether to use 12-hour time (as opposed to 24-hour time).void
setCalendar(Calendar calendar)
Sets the calendar to use.void
setDateStyle(DateTimeStyle style)
Sets the date formatting style to use when callingAbstractFormat.format(java.lang.Object)
.
dateStyle can be used with timeStyle, but not with other options (e.g.void
setDay(NumberItemStyle style)
Sets the representation of the Day.void
setDayPeriod(StringItemStyle dayPeriod)
Sets the way day periods should be expressed.void
setEra(StringItemStyle style)
Sets the representation of the Era.void
setFormatMatcher(FormatMatcher format)
Sets the format matching algorithm to use.void
setHour(NumberItemStyle style)
Sets the representation of the Hour.void
setHour12(boolean hour12)
Sets whether to use 12-hour time (as opposed to 24-hour time).void
setHourCycle(HourCycle hourCycle)
Sets the hour cycle to use.
ThesetHour12(boolean)
option takes precedence in case both options have been specified.void
setLocaleMatcher(LocaleMatcher localeMatcher)
Sets the locale matching algorithm to use.void
setMinute(NumberItemStyle style)
Sets the representation of the Minute.void
setMonth(MixedItemStyle style)
Sets the representation of the Month.void
setNumberingSystem(NumberingSystem numberingSystem)
Sets the numbering system to use.void
setSecond(NumberItemStyle style)
Sets the representation of the Second.void
setTimeStyle(DateTimeStyle style)
Sets the time formatting style to use when callingAbstractFormat.format(java.lang.Object)
.void
setTimeZone(TimeZone zone)
Sets the time zone to use.void
setTimeZoneName(TimeZoneName timeZoneName)
Sets the representation of the time zone name.void
setWeekDay(StringItemStyle style)
Sets the representation of the WeekDay.void
setYear(NumberItemStyle style)
Sets the representation of the Year.-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.defaults.IsDefaultBaseFormatOptions
getLocaleMatcher, getNumberingSystem
-
-
-
-
Field Detail
-
FACTORY
public static final DateTimeFormatOptions.DateTimeFormatOptionsFactory FACTORY
Public factory to create a date time format options from a native object.
-
-
Method Detail
-
setDateStyle
public void setDateStyle(DateTimeStyle style)
Sets the date formatting style to use when callingAbstractFormat.format(java.lang.Object)
.
dateStyle can be used with timeStyle, but not with other options (e.g. weekday, hour, month, etc.).- Parameters:
style
- the date formatting style
-
getDateStyle
public DateTimeStyle getDateStyle()
Returns the date formatting style to use when callingAbstractFormat.format(java.lang.Object)
.- Specified by:
getDateStyle
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the date formatting style
-
setTimeStyle
public void setTimeStyle(DateTimeStyle style)
Sets the time formatting style to use when callingAbstractFormat.format(java.lang.Object)
. timeStyle can be used with dateStyle, but not with other options (e.g. weekday, hour, month, etc.).- Parameters:
style
- the time formatting style
-
getTimeStyle
public DateTimeStyle getTimeStyle()
Returns the time formatting style to use when callingAbstractFormat.format(java.lang.Object)
.- Specified by:
getTimeStyle
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the time formatting style
-
setCalendar
public void setCalendar(Calendar calendar)
Sets the calendar to use.- Parameters:
calendar
- the calendar to use
-
getCalendar
public Calendar getCalendar()
Returns the calendar to use.- Specified by:
getCalendar
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the calendar to use
-
setDayPeriod
public void setDayPeriod(StringItemStyle dayPeriod)
Sets the way day periods should be expressed.- Parameters:
dayPeriod
- the way day periods should be expressed
-
getDayPeriod
public StringItemStyle getDayPeriod()
Returns the way day periods should be expressed.- Specified by:
getDayPeriod
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the way day periods should be expressed
-
setTimeZone
public void setTimeZone(TimeZone zone)
Sets the time zone to use.- Parameters:
zone
- the time zone to use
-
getTimeZone
public TimeZone getTimeZone()
Returns the time zone to use.- Specified by:
getTimeZone
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the time zone to use
-
setHour12
public void setHour12(boolean hour12)
Sets whether to use 12-hour time (as opposed to 24-hour time).- Parameters:
hour12
- whether to use 12-hour time (as opposed to 24-hour time)
-
isHour12
public boolean isHour12()
Returns whether to use 12-hour time (as opposed to 24-hour time).- Specified by:
isHour12
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- whether to use 12-hour time (as opposed to 24-hour time)
-
setHourCycle
public void setHourCycle(HourCycle hourCycle)
Sets the hour cycle to use.
ThesetHour12(boolean)
option takes precedence in case both options have been specified.- Parameters:
hourCycle
- the hour cycle to use
-
getHourCycle
public HourCycle getHourCycle()
Returns the hour cycle to use.- Specified by:
getHourCycle
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the hour cycle to use
-
setFormatMatcher
public void setFormatMatcher(FormatMatcher format)
Sets the format matching algorithm to use.- Parameters:
format
- the format matching algorithm to use
-
getFormatMatcher
public FormatMatcher getFormatMatcher()
Returns the format matching algorithm to use.- Specified by:
getFormatMatcher
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the format matching algorithm to use
-
setWeekDay
public void setWeekDay(StringItemStyle style)
Sets the representation of the WeekDay.- Parameters:
style
- the representation of the WeekDay
-
getWeekDay
public StringItemStyle getWeekDay()
Returns the representation of the WeekDay.- Specified by:
getWeekDay
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the WeekDay
-
setEra
public void setEra(StringItemStyle style)
Sets the representation of the Era.- Parameters:
style
- the representation of the Era
-
getEra
public StringItemStyle getEra()
Returns the representation of the Era.- Specified by:
getEra
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the Era
-
setYear
public void setYear(NumberItemStyle style)
Sets the representation of the Year.- Parameters:
style
- the representation of the Year
-
getYear
public NumberItemStyle getYear()
Returns the representation of the Year.- Specified by:
getYear
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the Year
-
setMonth
public void setMonth(MixedItemStyle style)
Sets the representation of the Month.- Parameters:
style
- the representation of the Month
-
getMonth
public MixedItemStyle getMonth()
Returns the representation of the Month.- Specified by:
getMonth
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the Month
-
setDay
public void setDay(NumberItemStyle style)
Sets the representation of the Day.- Parameters:
style
- the representation of the Day
-
getDay
public NumberItemStyle getDay()
Returns the representation of the Day.- Specified by:
getDay
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the Day
-
setHour
public void setHour(NumberItemStyle style)
Sets the representation of the Hour.- Parameters:
style
- the representation of the Hour
-
getHour
public NumberItemStyle getHour()
Returns the representation of the Hour.- Specified by:
getHour
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the Hour
-
setMinute
public void setMinute(NumberItemStyle style)
Sets the representation of the Minute.- Parameters:
style
- the representation of the Minute
-
getMinute
public NumberItemStyle getMinute()
Returns the representation of the Minute.- Specified by:
getMinute
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the Minute
-
setSecond
public void setSecond(NumberItemStyle style)
Sets the representation of the Second.- Parameters:
style
- the representation of the Second
-
getSecond
public NumberItemStyle getSecond()
Returns the representation of the Second.- Specified by:
getSecond
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the Second
-
setTimeZoneName
public void setTimeZoneName(TimeZoneName timeZoneName)
Sets the representation of the time zone name.- Parameters:
timeZoneName
- the representation of the time zone name
-
getTimeZoneName
public TimeZoneName getTimeZoneName()
Returns the representation of the time zone name.- Specified by:
getTimeZoneName
in interfaceIsDefaultDateTimeFormatOptions
- Returns:
- the representation of the time zone name
-
getDefaultValues
protected final D getDefaultValues()
- Returns:
- the defaultValues
-
setLocaleMatcher
public final void setLocaleMatcher(LocaleMatcher localeMatcher)
Sets the locale matching algorithm to use.- Parameters:
localeMatcher
- the locale matching algorithm to use
-
getLocaleMatcher
public final LocaleMatcher getLocaleMatcher()
Returns the locale matching algorithm to use.- Specified by:
getLocaleMatcher
in interfaceIsDefaultBaseFormatOptions
- Returns:
- the locale matching algorithm to use
-
setNumberingSystem
public final void setNumberingSystem(NumberingSystem numberingSystem)
Sets the numbering system to use.- Parameters:
numberingSystem
- the numbering system to use
-
getNumberingSystem
public final NumberingSystem getNumberingSystem()
Returns the numbering system to use.- Specified by:
getNumberingSystem
in interfaceIsDefaultBaseFormatOptions
- Returns:
- the numbering system to use
-
-