Package no.digipost.util
Class AttributesMap
java.lang.Object
no.digipost.util.AttributesMap
- All Implemented Interfaces:
Serializable
An immutable collection of
attributes.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder to incrementally construct an immutableAttributesMap.static enumSwitches to indicate behavior other than default. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributesMap.BuilderbuildNew(AttributesMap.Config... configSwitches) boolean<V> Vget(GetsNamedValue<V> attribute) Retrieve a required attribute value.inthashCode()booleanisEmpty()intsize()toString()static <V> AttributesMap.Builderwith(ViewableAsTuple<? extends SetsNamedValue<V>, V> attributeWithValue, AttributesMap.Config... configSwitches) static <V> AttributesMap.Builderwith(SetsNamedValue<V> attribute, V value, AttributesMap.Config... configSwitches)
-
Field Details
-
EMPTY
An empty map with no attributes.
-
-
Method Details
-
with
public static <V> AttributesMap.Builder with(ViewableAsTuple<? extends SetsNamedValue<V>, V> attributeWithValue, AttributesMap.Config... configSwitches) -
with
public static <V> AttributesMap.Builder with(SetsNamedValue<V> attribute, V value, AttributesMap.Config... configSwitches) -
buildNew
-
get
Retrieve a required attribute value. This method throws an exception if the attribute value is not present.- Parameters:
attribute- the attribute to retrieve.- Returns:
- the value
- Throws:
GetsNamedValue.NotFound- if the attribute is not present.
-
size
public int size()- Returns:
- the number of attributes contained in this map.
-
isEmpty
public boolean isEmpty()- Returns:
trueif this map contains no attributes,falseotherwise.
-
toString
-
equals
-
hashCode
public int hashCode()
-