Record Class Attributes
java.lang.Object
java.lang.Record
org.microbean.attributes.Attributes
- Record Components:
name- a non-nullname of thisAttributes; names that begin with the$character are reserved for internal usevalues- a non-nullMapof named values associated with thisAttributes; keys in thisMapthat begin with the$character are reserved for internal usenotes- a non-nullMapof non-normative named values associated with thisAttributes; keys in thisMapthat begin with the$character are reserved for internal useattributesMap- a non-nullMapof named metadata associated with thisAttributes; anyListstored under a key that is equal to the suppliednameis considered to be a list ofAttributespertaining to thisAttributesitself; other keys are normally (but are not required to be) the names of keys in the suppliedvaluesornotesMaps; keys that begin with the$character are reserved for internal use
- All Implemented Interfaces:
Comparable<Attributes>,Constable,Attributed,Value<Attributes>
public record Attributes(String name, Map<String,Value<?>> values, Map<String,Value<?>> notes, Map<String, List<Attributes>> attributesMap)
extends Record
implements Attributed, Value<Attributes>
- Author:
- Laird Nelson
-
Constructor Summary
ConstructorsConstructorDescriptionAttributes(String name, Map<String, Value<?>> values, Map<String, Value<?>> notes, Map<String, List<Attributes>> attributesMap) Creates a newAttributes. -
Method Summary
Modifier and TypeMethodDescriptionfinal List<Attributes> Returns aListofAttributesassociated with thisAttributesdirectly, or an emptyListif there is no suchList.final List<Attributes> attributes(String key) Returns aListofAttributesassociated with the suppliedkey, or an emptyListif there is no suchList.Map<String, List<Attributes>> Returns the value of theattributesMaprecord component.final intcompareTo(Attributes other) final Optional<DynamicConstantDesc<Attributes>> final booleanfinal inthashCode()Returns a hash code value for thisAttributesderived solely from its values.name()Returns the value of thenamerecord component.notes()Returns the value of thenotesrecord component.static final AttributesReturns anAttributescomprising the supplied arguments.static final AttributesReturns anAttributescomprising the supplied arguments.static final Attributesof(String name, List<Attributes> attributes) Returns anAttributescomprising the supplied arguments.static final Attributesof(String name, Map<String, Value<?>> values, Map<String, Value<?>> notes, Map<String, List<Attributes>> attributes) Returns anAttributescomprising the supplied arguments.static final Attributesof(String name, Attributes... attributes) Returns anAttributescomprising the supplied arguments.final StringtoString()Returns a string representation of this record class.final <T extends Value<T>>
Tvalues()Returns the value of thevaluesrecord component.
-
Constructor Details
-
Attributes
public Attributes(String name, Map<String, Value<?>> values, Map<String, Value<?>> notes, Map<String, List<Attributes>> attributesMap) Creates a newAttributes.- Parameters:
name- a non-nullname of thisAttributesvalues- a non-nullMapof named values associated with thisAttributes; keys in thisMapthat begin with the$character are reserved for internal usenotes- a non-nullMapof non-normative named values associated with thisAttributes; keys in thisMapthat begin with the$character are reserved for internal useattributesMap- a non-nullMapof named metadata associated with thisAttributes; anyListstored under a key that is equal to the suppliednameis considered to be a list ofAttributespertaining to thisAttributesitself; other keys are normally (but are not required to be) the names of keys in the suppliedvaluesornotesMaps; keys in thisMapthat begin with the$character are reserved for internal use- Throws:
NullPointerException- if any argument isnull
-
-
Method Details
-
attributes
Returns aListofAttributesassociated with thisAttributesdirectly, or an emptyListif there is no suchList.- Specified by:
attributesin interfaceAttributed- Returns:
- a non-
nullListofAttributes - See Also:
-
attributes
Returns aListofAttributesassociated with the suppliedkey, or an emptyListif there is no suchList.- Parameters:
key- aString; must not benull- Returns:
- a non-
nullListofAttributes - Throws:
NullPointerException- ifkeyisnull
-
compareTo
- Specified by:
compareToin interfaceComparable<Attributes>
-
describeConstable
- Specified by:
describeConstablein interfaceConstable
-
equals
Returnstrueif thisAttributesequals the suppliedObject.If the supplied
Objectis also anAttributesand has a name equal to thisAttributes' name and a valuesMapequal to thisAttributes' valuesMap, this method returnstrue.This method returns
falsein all other cases.- Specified by:
equalsin classRecord- Parameters:
other- anObject; may benull- Returns:
trueif thisAttributesequals the suppliedObject- See Also:
-
hashCode
Returns a hash code value for thisAttributesderived solely from its values. -
toString
-
value
- Type Parameters:
T- the type of theValue- Parameters:
name- the name; must not benull- Returns:
- a suitably-typed
Valueindexed under the suppliedname, ornullif no suchValueexists - Throws:
NullPointerException- ifnameisnullClassCastException- if<T>does not match the actual type of theValueindexed under the suppliedname
-
of
Returns anAttributescomprising the supplied arguments.- Parameters:
name- the name; must not benull- Returns:
- a non-
nullAttributes - Throws:
NullPointerException- ifnameisnull- See Also:
-
of
Returns anAttributescomprising the supplied arguments.- Parameters:
name- the name; must not benullvalueValue- aStringthat will be indexed under the key "value"; must not benull- Returns:
- a non-
nullAttributes - Throws:
NullPointerException- ifnameorvalueValueisnull- See Also:
-
of
Returns anAttributescomprising the supplied arguments.- Parameters:
name- the name; must not benullattributes- an array ofAttributes; may benull- Returns:
- a non-
nullAttributes - Throws:
NullPointerException- ifnameisnull- See Also:
-
of
Returns anAttributescomprising the supplied arguments.- Parameters:
name- the name; must not benullattributes- a non-nullListofAttributes- Returns:
- a non-
nullAttributes - Throws:
NullPointerException- if any argument isnull- See Also:
-
of
public static final Attributes of(String name, Map<String, Value<?>> values, Map<String, Value<?>> notes, Map<String, List<Attributes>> attributes) Returns anAttributescomprising the supplied arguments.- Parameters:
name- the name; must not benullvalues- aMapofValues indexed byStringkeys; must not benullnotes- aMapofValues indexed byStringkeys containing descriptive information only; must not benull; not incorporated into equality calculationsattributes- aMapofLists ofAttributesinstances denoting metadata for a given value invalues(or for thisAttributesas a whole if the key in question is equal toname); must not benull- Returns:
- a non-
nullAttributes - Throws:
NullPointerException- if any argument isnull
-
name
-
values
-
notes
-
attributesMap
Returns the value of theattributesMaprecord component.- Returns:
- the value of the
attributesMaprecord component
-