public final class NominalValue extends Object implements Value, Comparable<NominalValue>, Serializable
String value.| Constructor and Description |
|---|
NominalValue(String val)
Creates a new nominal value with the given value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ValueVisitor valueVisitor)
Performs some processing on a value.
|
NominalValueBuilder |
asBuilder() |
ValueComparator |
compare(Value o)
Compares this nominal value and another lexically.
|
int |
compareTo(NominalValue t) |
boolean |
equals(Object obj)
Compares this nominal value and another for string equality.
|
String |
format(Format format)
Returns a string representing this value, formatted by the
provided
Format. |
String |
getFormatted()
Returns the same thing as
getString(). |
static NominalValue |
getInstance(String val)
Creates a new nominal value.
|
String |
getString()
Gets the value as a Java
String. |
ValueType |
getType()
Returns this object's type, guaranteed not
null. |
int |
hashCode() |
NominalValue |
replace()
Returns a value from a cache that is equal to this one, if such a value
exists.
|
String |
toString() |
public NominalValue(String val)
getInstance(java.lang.String).val - a String. If null, the default
string is used ("").public static NominalValue getInstance(String val)
val's length is less than 20
characters, the created NominalValue object will be cached and
reused.val - a String. If null, NominalValue
with "" will be created.NominalValue.public NominalValue replace()
Valuepublic boolean equals(Object obj)
public String getFormatted()
getString().getFormatted in interface ValueString. Guaranteed not null.public String format(Format format)
ValueFormat.format in interface Valueformat - a Format. Passing in a null will
result in the same behavior as Value.getFormatted().String.public ValueType getType()
Valuenull.public ValueComparator compare(Value o)
ListValue, it checks this string for membership in the list.compare in interface Valueo - another Value.NominalValue, returns null ValueComparator.GREATER_THAN,
ValueComparator.LESS_THAN or ValueComparator.EQUAL_TO
depending on whether this nominal value is lexically greater than, less
than or equal to the nominal value provided as argument. If the provided
value is a ValueList, returns ValueComparator.IN if this
object is a member of the list, or ValueComparator.NOT_IN if not.
Otherwise, returns ValueComparator.UNKNOWN.public void accept(ValueVisitor valueVisitor)
ValueVisitableaccept in interface ValueVisitablepublic int compareTo(NominalValue t)
compareTo in interface Comparable<NominalValue>public NominalValueBuilder asBuilder()
Copyright © 2012–2017 Emory University. All rights reserved.