public final class UnitName extends UnitID implements java.lang.Comparable<java.lang.Object>
| Modifier | Constructor and Description |
|---|---|
protected |
UnitName(java.lang.String name,
java.lang.String symbol)
Constructs from a name and a symbol.
|
protected |
UnitName(java.lang.String name,
java.lang.String plural,
java.lang.String symbol)
Constructs from a name, a plural form of the unit name, and a symbol.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(java.lang.Object object)
Compares this UnitName with another UnitName.
|
boolean |
equals(java.lang.Object object)
Indicates if this UnitName is semantically identical to an object.
|
java.lang.String |
getName()
Returns the name.
|
java.lang.String |
getPlural()
Returns the plural form of the unit name.
|
java.lang.String |
getSymbol()
Returns the symbol.
|
int |
hashCode()
Returns the hash code of this instance.
|
protected java.lang.String |
makePlural(java.lang.String name)
Returns the plural form of a name.
|
static UnitName |
newUnitName(java.lang.String name)
Factory method for constructing a UnitName from a name.
|
static UnitName |
newUnitName(java.lang.String name,
java.lang.String plural)
Factory method for constructing a UnitName from a name and a plural form
of the name.
|
static UnitName |
newUnitName(java.lang.String name,
java.lang.String plural,
java.lang.String symbol)
Factory method for constructing a UnitName from a name, a plural form of
the name, and a symbol.
|
java.lang.String |
toString()
Returns the string representation of this identifier.
|
protected UnitName(java.lang.String name,
java.lang.String symbol)
throws NameException
name - The name of the unit. Shall not be
null.symbol - The symbol for the unit. May be null
.NameException - name == null.protected UnitName(java.lang.String name,
java.lang.String plural,
java.lang.String symbol)
throws NameException
name - The name of the unit. Shall not be
null.plural - The plural form of the name. May be
null, in which
case regular plural- forming rules are used to construct the
plural form from the name.symbol - The symbol for the unit. May be null
.NameException - name == null.public static UnitName newUnitName(java.lang.String name) throws NameException
name - The name of the unit. Shall not be
null.NameException - name == null.public static UnitName newUnitName(java.lang.String name, java.lang.String plural) throws NameException
name - The name of the unit. Shall not be
null.plural - The plural form of the name. May be
null, in which
case regular plural- forming rules are used to construct the
plural form from the name.NameException - name == null.public static UnitName newUnitName(java.lang.String name, java.lang.String plural, java.lang.String symbol) throws NameException
name - The name of the unit. Shall not be
null.plural - The plural form of the name. May be
null, in which
case regular plural- forming rules are used to construct the
plural form from the name.symbol - The symbol for the unit. May be null
.NameException - name == null.public final java.lang.String getName()
public java.lang.String getPlural()
public final java.lang.String getSymbol()
public final java.lang.String toString()
public final int compareTo(java.lang.Object object)
compareTo in interface java.lang.Comparable<java.lang.Object>public final boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectprotected java.lang.String makePlural(java.lang.String name)
name - The name.