public enum Meridiem extends Enum<Meridiem> implements ChronoCondition<WallTime>
Represents the half day relative to noon.
| Enum Constant and Description |
|---|
AM
Marks the wall time from midnight (at start of day) until
before noon (ante meridiem).
|
PM
Marks the wall time at or after noon (post meridiem).
|
| Modifier and Type | Method and Description |
|---|---|
String |
getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT). |
String |
getDisplayName(Locale locale,
TextWidth width,
OutputContext context)
Gets the description text dependent on the locale and style
parameters.
|
static Meridiem |
ofHour(int hour)
Calculates the meridiem value dependent on given hour of day.
|
static Meridiem |
parse(CharSequence text,
Locale locale,
TextWidth width,
OutputContext context)
Tries to interprete given text as AM/PM.
|
boolean |
test(WallTime context)
Decides if given context matches this condition.
|
static Meridiem |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Meridiem[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Meridiem AM
Marks the wall time from midnight (at start of day) until before noon (ante meridiem).
The numerical value is 0.
public static final Meridiem PM
Marks the wall time at or after noon (post meridiem).
The numerical value is 1.
public static Meridiem[] values()
for (Meridiem c : Meridiem.values()) System.out.println(c);
public static Meridiem valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static Meridiem ofHour(int hour)
Calculates the meridiem value dependent on given hour of day.
hour - ISO-hour in the range 0 <= hour <= 24IllegalArgumentException - if the hour is out of rangePlainTime.AM_PM_OF_DAYpublic String getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT).
locale - language of text to be printedpublic String getDisplayName(Locale locale, TextWidth width, OutputContext context)
Gets the description text dependent on the locale and style parameters.
The second argument controls the width of description while the third argument is only relevant for languages which make a difference between stand-alone forms and embedded text forms (does not matter in English).
locale - language settingwidth - text widthcontext - output contextnull)public static Meridiem parse(CharSequence text, Locale locale, TextWidth width, OutputContext context) throws ParseException
Tries to interprete given text as AM/PM.
The strings "am", "AM", "pm", "PM" are always understood.
text - the text to be parsedlocale - language settingwidth - expected text widthcontext - expected output contextParseException - if parsing failsgetDisplayName(Locale, TextWidth, OutputContext)public boolean test(WallTime context)
ChronoConditionDecides if given context matches this condition.
Due to better readability it is recommended to use following equivalent approach instead of this method::
import static net.time4j.Weekday.SATURDAY; import static net.time4j.Month.JANUARY; PlainDate date = PlainDate.of(2014, JANUARY, 25); System.out.println(SATURDAY.test(date)); // direct use System.out.println(date.matches(SATURDAY)); // recommended callback
Copyright © 2014–2017. All rights reserved.