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 an IConstraint 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 Details

    • keySet

      Set<K> keySet()
      Returns:
      A 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, get(Object) may return null for some keys included in this set.
    • get

      Object get(K key)
      Get the mapped value for key, or null if no value is currently mapped. If this method ever returns a non-null value, getConstraint(Object) for the same key will from that point forward return the same matching non-null constraint.
      Returns:
      the mapped value or null
    • getConstraint

      IConstraint<?> getConstraint(K key)
      Get a constraint for mapped values of key, if a constraint has been imposed for key.
      Returns:
      a constraint or null
    • getPersistableString

      String getPersistableString(K key)
      Get the persistable string of the mapped value for key, or null if no value is currently mapped. If this method ever returns a non-null value, getConstraint(Object) for the same key will from that point forward return the same matching non-null constraint.
      Returns:
      a persistable string or null
    • emptyWithSameConstraints

      IMutableConstrainedMap<K> emptyWithSameConstraints()
      Create an empty mutable map, with the same initial constraints as this map. It might be possible to add constraints to the created map, depending on the restrictions built into this map.
    • mutableCopy

      IMutableConstrainedMap<K> mutableCopy()
      Create a mutable copy of this map, containing the same initial values as this map. It might be possible to add constraints to the copy, depending on the restrictions built into this map.