V - generic type of element valuespublic abstract class BasicElement<V extends Comparable<V>> extends Object implements ChronoElement<V>, Serializable
Abstract base implementation of a chronological element which has a name and can also define an (unregistered) element rule.
| Modifier and Type | Method and Description |
|---|---|
int |
compare(ChronoDisplay o1,
ChronoDisplay o2)
Compares the values of this element based on their natural order.
|
boolean |
equals(Object obj)
Based on equality of element names AND element classes.
|
String |
getDisplayName(Locale language)
Obtains a localized name for display purposes if possible.
|
char |
getSymbol()
There is no format symbol by default.
|
int |
hashCode()
Based on the element name.
|
boolean |
isLenient()
Chronological elements are strict by default.
|
boolean |
isLocal()
Elements are local by default and can therefore not be used
in a global context.
|
String |
name()
Returns the name which is unique within the context of a given
chronology.
|
String |
toString()
Serves mainly for debugging support.
|
getDefaultMaximum, getDefaultMinimum, getType, isDateElement, isTimeElementpublic final String name()
ChronoElementReturns the name which is unique within the context of a given chronology.
The name can also serve as resource key together with the name of a chronology for a localized description.
name in interface ChronoElement<V extends Comparable<V>>public String getDisplayName(Locale language)
ChronoElementObtains a localized name for display purposes if possible.
Most elements have no localized names, but in case the i18n-module is loaded then elements like eras, years, quarters, months, weeks, day-of-month, day-of-week, am/pm, hour, minute and second do have localization support. The default implementation falls back to the technical element name.
Note that the displayed name does not need to be unique for different elements. For example the
localized names of PlainDate.MONTH_OF_YEAR and PlainDate.MONTH_AS_NUMBER are equal.
getDisplayName in interface ChronoElement<V extends Comparable<V>>language - language settinga technical name will be chosenpublic int compare(ChronoDisplay o1, ChronoDisplay o2)
Compares the values of this element based on their natural order.
compare in interface Comparator<ChronoDisplay>compare in interface ChronoElement<V extends Comparable<V>>o1 - the first object to be comparedo2 - the second object to be comparedChronoException - if this element is not registered in any entity
and/or if no element rule exists to extract the element valuepublic char getSymbol()
There is no format symbol by default.
In order to define a format symbol subclasses must override this
methode. In that case such an element instance should be annotated
with the annotation FormattableElement for documentation
support.
getSymbol in interface ChronoElement<V extends Comparable<V>>FormattableElementpublic boolean isLenient()
Chronological elements are strict by default.
isLenient in interface ChronoElement<V extends Comparable<V>>falseElementRule.withValue(T, V, boolean)public boolean isLocal()
Elements are local by default and can therefore not be used in a global context.
trueBasicElement.getVeto(Chronology)public final boolean equals(Object obj)
Based on equality of element names AND element classes.
equals in interface Comparator<ChronoDisplay>equals in class Objecttrue if this instance and the argument are of same
class and have same names else falsepublic final int hashCode()
Based on the element name.
public String toString()
Serves mainly for debugging support.
For display purpose the method BasicElement.name() is to be
preferred.
Copyright © 2014–2018. All rights reserved.