Class AttributeMapInstance<T>
- Type Parameters:
T- the Java value type stored in every instance of the AttributeMap
- All Implemented Interfaces:
AttributeRead<T>
Create a selector with AttributeMap.instance(String). Pass it to
Client.getAttributes(String, AttributeRead...) together with singleton Attributes. Then
pass it, or an equal selector, to AttributeValues.get(AttributeRead) to obtain the typed
value. Selectors are immutable and safe to share between threads. A selector holds no value.
AttributeValues.get(AttributeRead) returns the same decoded value object each time it is
called with an equal selector, and it does not copy that value.
Two selectors are equal when they refer to the same AttributeMap object and their
instance keys are equal strings. Calling instance("n1") twice on the same AttributeMap
therefore yields equal selectors. An AttributeMap object created by another
AttributeMap.define(String, Class) call is a different definition, even when its name and value type
are the same.
AttributeMap<Note> notes = orderFlow.notes;
AttributeValues values = client.getAttributes("order-42", notes.instance("n1"));
Optional<Note> firstNote = values.get(notes.instance("n1"));
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this selector with another object.Returns the AttributeMap definition that owns the selected instance.Returns the logical instance key.inthashCode()Returns a hash code consistent withequals(Object).toString()Returns the physical Attribute key of the selected instance.
-
Method Details
-
getAttributeMap
Returns the AttributeMap definition that owns the selected instance.- Returns:
- the AttributeMap object passed to
AttributeMap.instance(String)
-
getInstance
Returns the logical instance key.- Returns:
- the non-blank instance key, which contains no
/
-
equals
-
hashCode
public int hashCode()Returns a hash code consistent withequals(Object). -
toString
-