public class NamedValue<V> extends Association<java.lang.String,V> implements java.lang.Comparable
Constructor and Description |
---|
NamedValue(java.lang.String name)
Initialize the new instance with a name and a null value.
|
NamedValue(java.lang.String name,
V value)
Initialize the new instance with a name and an associated value.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object obj)
Compares this object with the specified object for order.
|
NamedValue<V> |
copyNamedValue()
Returns a copy of this object
|
void |
key(java.lang.String newKey)
Sets the new key.
|
java.lang.String |
name()
Returns the name (key) of the association.
|
void |
name(java.lang.String newName)
Sets the name (key) of the association.
|
static <T> NamedValue<T> |
of(java.lang.String name,
T value)
Creates a new instance with a name and an associated value.
|
copyAssociation, equals, getKey, getValue, hashCode, key, setValue, toString, value, value
public NamedValue(java.lang.String name)
public NamedValue(java.lang.String name, V value)
public static <T> NamedValue<T> of(java.lang.String name, T value)
public void key(java.lang.String newKey)
key
in class Association<java.lang.String,V>
public void name(java.lang.String newName)
newName
- The new key (must not be null !)public java.lang.String name()
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public NamedValue<V> copyNamedValue()