V - generic type of element valuespublic abstract class BasicElement<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 | Constructor and Description |
|---|---|
protected |
BasicElement(String name)
Called by subclasses which will usually assign an instance to
a static constant (creating a singleton).
|
| Modifier and Type | Method and Description |
|---|---|
protected <T extends ChronoEntity<T>> |
derive(Chronology<T> chronology)
Derives an optional element rule for given chronology.
|
boolean |
equals(Object obj)
Based on equality of element names AND element classes.
|
protected ChronoElement<?> |
getParent()
Points to another element which can have a base unit in a given
chronology.
|
char |
getSymbol()
There is no format symbol by default.
|
protected String |
getVeto(Chronology<?> chronology)
If this element is not registered in given chronology then this method
will be called by Time4J in order to generate a suitable error message
in cases where this element shall not support the chronological context.
|
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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcompare, getDefaultMaximum, getDefaultMinimum, getType, isDateElement, isTimeElementprotected BasicElement(String name)
Called by subclasses which will usually assign an instance to a static constant (creating a singleton).
name - name of elementIllegalArgumentException - if the name is empty or only
contains white space (spaces, tabs etc.)ChronoElement.name()public 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>public 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>FormattableElementpublic boolean isLenient()
Chronological elements are strict by default.
isLenient in interface ChronoElement<V>falseElementRule.withValue(T, V, boolean)public boolean isLocal()
Elements are local by default and can therefore not be used in a global context.
truegetVeto(Chronology)public 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 int hashCode()
Based on the element name.
public String toString()
Serves mainly for debugging support.
For display purpose the method name() is to be
preferred.
protected <T extends ChronoEntity<T>> ElementRule<T,V> derive(Chronology<T> chronology)
Derives an optional element rule for given chronology.
Note: This implementation yields null. Subclasses whose
element instances are not registered in a given chronology must
override this method returning a suitable element rule.
T - generic type of chronologychronology - chronology an element rule is searched fornull if given chronology is unsupportedprotected ChronoElement<?> getParent()
Points to another element which can have a base unit in a given chronology.
This method can be overridden by unregistered extension elements in order to help a chronology to see which base unit belongs to this element.
nullTimeAxis.getBaseUnit(ChronoElement)protected String getVeto(Chronology<?> chronology)
If this element is not registered in given chronology then this method will be called by Time4J in order to generate a suitable error message in cases where this element shall not support the chronological context.
This implementation yields null to indicate that there is no
veto against usage in given chronology unless this element is local but
the given chronology is global.
chronology - chronological contextnullCopyright © 2014–2015. All rights reserved.