Package no.digipost.util
Class AttributesMap
- java.lang.Object
-
- no.digipost.util.AttributesMap
-
- All Implemented Interfaces:
Serializable
public final class AttributesMap extends Object implements Serializable
An immutable collection ofattributes.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAttributesMap.BuilderBuilder to incrementally construct an immutableAttributesMap.static classAttributesMap.ConfigSwitches to indicate behavior other than default.
-
Field Summary
Fields Modifier and Type Field Description static AttributesMapEMPTYAn empty map with no attributes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AttributesMap.BuilderbuildNew(AttributesMap.Config... configSwitches)booleanequals(Object obj)<V> Vget(GetsNamedValue<V> attribute)Retrieve a required attribute value.inthashCode()booleanisEmpty()intsize()StringtoString()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 Detail
-
EMPTY
public static final AttributesMap EMPTY
An empty map with no attributes.
-
-
Method Detail
-
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
public static AttributesMap.Builder buildNew(AttributesMap.Config... configSwitches)
-
get
public <V> V get(GetsNamedValue<V> attribute)
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.
-
-