Package org.openjdk.jmc.common.unit
Interface IConstrainedMap<K>
-
- Type Parameters:
K
- the type of the keys in the map
- All Known Subinterfaces:
IDescribedMap<K>
,IMutableConstrainedMap<K>
- All Known Implementing Classes:
MutableConstrainedMap
,SimpleConstrainedMap
public interface IConstrainedMap<K>
Read only interface for a map where the values are constrained by anIConstraint
per key. Note that as this is read only, its methods shouldn't throw any exceptions. This means that all implementations must ensure upon creation and insertion that their contents are valid.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IMutableConstrainedMap<K>
emptyWithSameConstraints()
Object
get(K key)
Get the mapped value forkey
, or null if no value is currently mapped.IConstraint<?>
getConstraint(K key)
String
getPersistableString(K key)
Get the persistable string of the mapped value forkey
, or null if no value is currently mapped.Set<K>
keySet()
IMutableConstrainedMap<K>
mutableCopy()
-
-
-
Method Detail
-
keySet
Set<K> keySet()
- Returns:
- A
set
of keys which are known to be valid. That is, those that currently are known to have aconstraint
. This includes all keys which currently have a value, but additional keys may be included. In other words,get(Object)
may returnnull
for some keys included in this set.
-
get
Object get(K key)
Get the mapped value forkey
, or null if no value is currently mapped. If this method ever returns a non-null value,getConstraint(Object)
for the samekey
will from that point forward return the same matching non-null constraint.- Returns:
- the mapped value or
null
-
getConstraint
IConstraint<?> getConstraint(K key)
- Returns:
- a constraint or
null
-
getPersistableString
String getPersistableString(K key)
Get the persistable string of the mapped value forkey
, or null if no value is currently mapped. If this method ever returns a non-null value,getConstraint(Object)
for the samekey
will from that point forward return the same matching non-null constraint.- Returns:
- a persistable string or
null
-
emptyWithSameConstraints
IMutableConstrainedMap<K> emptyWithSameConstraints()
Create an emptymutable
map, with the same initial constraints as thismap
. It might be possible to addconstraints
to the created map, depending on the restrictions built into this map.
-
mutableCopy
IMutableConstrainedMap<K> mutableCopy()
Create amutable
copy of thismap
, containing the same initial values as this map. It might be possible to addconstraints
to the copy, depending on the restrictions built into this map.
-
-