IdentifierType
- The type of identifier for the value. Must implement valid equals
and hashCode methods.ValueType
- The type of value stored with the identifier.public class DefaultIdentifiedValue<IdentifierType,ValueType> extends AbstractCloneableSerializable implements IdentifiedValue<IdentifierType,ValueType>
IdentifiedValue
interface that
stores a value along with its identifier.Modifier and Type | Field and Description |
---|---|
protected IdentifierType |
identifier
The identifier for the value.
|
protected ValueType |
value
The value.
|
Constructor and Description |
---|
DefaultIdentifiedValue()
Creates a new
DefaultIdentifiedValue with null identifier and
value. |
DefaultIdentifiedValue(IdentifierType identifier,
ValueType value)
Creates a new
DefaultIdentifiedValue with the given identifier
and value. |
Modifier and Type | Method and Description |
---|---|
static <IdentifierType,ValueType> |
create()
Convenience method to create a new, empty
DefaultIdentifiedValue . |
static <IdentifierType,ValueType> |
create(IdentifierType identifier,
ValueType value)
Creates a new
DefaultIdentifiedValue with the given identifier
and value. |
IdentifierType |
getIdentifier()
Gets the identifier for this object.
|
ValueType |
getValue()
Gets the value associated with the identifier.
|
void |
setIdentifier(IdentifierType identifier)
Sets the identifier.
|
void |
setValue(ValueType value)
Sets the value.
|
clone
protected IdentifierType identifier
protected ValueType value
public DefaultIdentifiedValue()
DefaultIdentifiedValue
with null identifier and
value.public DefaultIdentifiedValue(IdentifierType identifier, ValueType value)
DefaultIdentifiedValue
with the given identifier
and value.identifier
- The identifier for the value.value
- The value.public IdentifierType getIdentifier()
Identified
getIdentifier
in interface Identified<IdentifierType>
public void setIdentifier(IdentifierType identifier)
identifier
- The identifier for the value.public ValueType getValue()
IdentifiedValue
getValue
in interface IdentifiedValue<IdentifierType,ValueType>
public void setValue(ValueType value)
value
- The value associated with the identifier.public static <IdentifierType,ValueType> DefaultIdentifiedValue<IdentifierType,ValueType> create()
DefaultIdentifiedValue
.IdentifierType
- The type of identifier for the value. Must implement valid equals
and hashCode methods.ValueType
- The type of value stored.DefaultIdentifiedValue
.public static <IdentifierType,ValueType> DefaultIdentifiedValue<IdentifierType,ValueType> create(IdentifierType identifier, ValueType value)
DefaultIdentifiedValue
with the given identifier
and value.IdentifierType
- The type of identifier for the value. Must implement valid equals
and hashCode methods.ValueType
- The type of value stored.identifier
- The identifier for the value.value
- The value.DefaultIdentifiedValue
with the given identifier and
value.