K - the type of the keys in the mappublic abstract class MutableConstrainedMap<K> extends Object implements IMutableConstrainedMap<K>
IConstrainedMap. Note that it is the values that can be mutated.
Existing constraints cannot be modified. However, some implementations may allow adding
constraints for keys that currently doesn't have a constraint, and thus no current value.| Modifier | Constructor and Description |
|---|---|
protected |
MutableConstrainedMap() |
protected |
MutableConstrainedMap(HashMap<K,Object> values) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConstraint(K key,
IConstraint<?> constraint) |
Object |
get(K key)
Get the mapped value for
key, or null if no value is currently mapped. |
abstract IConstraint<?> |
getConstraint(K key)
|
String |
getPersistableString(K key)
Get the persistable string of the mapped value for
key, or null if no value is
currently mapped. |
protected IConstraint<?> |
getSuggestedConstraint(K key)
This method will only be called for keys for which
getConstraint(Object) currently
returns null for. |
Set<K> |
keySet() |
<T> void |
put(K key,
IConstraint<T> constraint,
T value)
Map
key to value, if allowed according to constraint and additional
restrictions on this map such as a conflicting constraint being in effect
for this key. |
void |
put(K key,
Object value)
Map
key to value, if allowed according to either an existing
constraint or an implicit default constraint, if available. |
<T> void |
putPersistedString(K key,
IConstraint<T> constraint,
String persisted)
Map
key to the value obtained by parsing persisted, if allowed according to
constraint and additional restrictions on this map such as a conflicting
constraint being in effect for this key. |
void |
putPersistedString(K key,
String persisted)
Map
key to the value obtained by parsing persisted, if allowed according to
either an existing constraint or an implicit default constraint, if
available. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitemptyWithSameConstraints, mutableCopypublic Set<K> keySet()
keySet in interface IConstrainedMap<K>set of keys which are known to be valid. That is, those that currently
are known to have a constraint. This includes all keys which
currently have a value, but additional keys may be included. In other words,
IConstrainedMap.get(Object) may return null for some keys included in this set.public Object get(K key)
IConstrainedMapkey, or null if no value is currently mapped. If this method
ever returns a non-null value, IConstrainedMap.getConstraint(Object) for the same key will
from that point forward return the same matching non-null constraint.get in interface IConstrainedMap<K>nullpublic abstract IConstraint<?> getConstraint(K key)
IConstrainedMapgetConstraint in interface IConstrainedMap<K>nullprotected IConstraint<?> getSuggestedConstraint(K key)
getConstraint(Object) currently
returns null for. Thus, it doesn't matter, and is unspecified, what it would return for keys
which getConstraint(Object) return non-null for, which typically simplifies the
implementations.public String getPersistableString(K key)
IConstrainedMapkey, or null if no value is
currently mapped. If this method ever returns a non-null value,
IConstrainedMap.getConstraint(Object) for the same key will from that point forward return
the same matching non-null constraint.getPersistableString in interface IConstrainedMap<K>nullpublic void put(K key, Object value) throws QuantityConversionException
IMutableConstrainedMapkey to value, if allowed according to either an existing
constraint or an implicit default constraint, if available.put in interface IMutableConstrainedMap<K>QuantityConversionException - if value is rejected by the constraint in some other waypublic void putPersistedString(K key, String persisted) throws QuantityConversionException
IMutableConstrainedMapkey to the value obtained by parsing persisted, if allowed according to
either an existing constraint or an implicit default constraint, if
available.putPersistedString in interface IMutableConstrainedMap<K>QuantityConversionException - if persisted is rejected by the constraint in some waypublic <T> void put(K key, IConstraint<T> constraint, T value) throws QuantityConversionException
IMutableConstrainedMapkey to value, if allowed according to constraint and additional
restrictions on this map such as a conflicting constraint being in effect
for this key.put in interface IMutableConstrainedMap<K>QuantityConversionException - if value is rejected by the constraint in some other wayprotected void addConstraint(K key, IConstraint<?> constraint)
public <T> void putPersistedString(K key, IConstraint<T> constraint, String persisted) throws QuantityConversionException
IMutableConstrainedMapkey to the value obtained by parsing persisted, if allowed according to
constraint and additional restrictions on this map such as a conflicting
constraint being in effect for this key.putPersistedString in interface IMutableConstrainedMap<K>QuantityConversionException - if persisted is rejected by the constraint in some other wayCopyright © 2019. All rights reserved.