Package org.openjdk.jmc.common.unit
Class SimpleConstrainedMap<K>
java.lang.Object
org.openjdk.jmc.common.unit.MutableConstrainedMap<K>
org.openjdk.jmc.common.unit.SimpleConstrainedMap<K>
- Type Parameters:
K- the type of the keys in the map
- All Implemented Interfaces:
IConstrainedMap<K>,IMutableConstrainedMap<K>
Simple constrained map that allows constraints to be added, and an optional fallback constraint.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<K,IConstraint<?>> protected final IConstraint<?>Fields inherited from class org.openjdk.jmc.common.unit.MutableConstrainedMap
values -
Constructor Summary
ConstructorsModifierConstructorDescriptionSimpleConstrainedMap(Map<K, IConstraint<?>> constraints, IConstraint<?> fallback) protectedSimpleConstrainedMap(Map<K, IConstraint<?>> constraints, IConstraint<?> fallback, Map<K, Object> values) SimpleConstrainedMap(IConstraint<?> fallback) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddConstraint(K key, IConstraint<?> constraint) IConstraint<?>getConstraint(K key) protected IConstraint<?>getSuggestedConstraint(K key) This method will only be called for keys for whichMutableConstrainedMap.getConstraint(Object)currently returns null for.Methods inherited from class org.openjdk.jmc.common.unit.MutableConstrainedMap
get, getPersistableString, keySet, put, put, putPersistedString, putPersistedString
-
Field Details
-
constraints
-
fallback
-
-
Constructor Details
-
SimpleConstrainedMap
public SimpleConstrainedMap() -
SimpleConstrainedMap
-
SimpleConstrainedMap
-
SimpleConstrainedMap
protected SimpleConstrainedMap(Map<K, IConstraint<?>> constraints, IConstraint<?> fallback, Map<K, Object> values)
-
-
Method Details
-
getConstraint
Description copied from interface:IConstrainedMap- Specified by:
getConstraintin interfaceIConstrainedMap<K>- Specified by:
getConstraintin classMutableConstrainedMap<K>- Returns:
- a constraint or
null
-
getSuggestedConstraint
Description copied from class:MutableConstrainedMapThis method will only be called for keys for whichMutableConstrainedMap.getConstraint(Object)currently returns null for. Thus, it doesn't matter, and is unspecified, what it would return for keys whichMutableConstrainedMap.getConstraint(Object)return non-null for, which typically simplifies the implementations.- Overrides:
getSuggestedConstraintin classMutableConstrainedMap<K>
-
addConstraint
- Overrides:
addConstraintin classMutableConstrainedMap<K>
-
emptyWithSameConstraints
Description copied from interface:IConstrainedMapCreate an emptymutablemap, with the same initial constraints as thismap. It might be possible to addconstraintsto the created map, depending on the restrictions built into this map. -
mutableCopy
Description copied from interface:IConstrainedMapCreate amutablecopy of thismap, containing the same initial values as this map. It might be possible to addconstraintsto the copy, depending on the restrictions built into this map.
-