Class ComplexAttributeImpl
- All Implemented Interfaces:
Attribute
,ComplexAttribute
,Property
- Direct Known Subclasses:
FeatureImpl
-
Field Summary
Fields inherited from class AttributeImpl
id
Fields inherited from class PropertyImpl
descriptor, value
-
Constructor Summary
ConstructorsConstructorDescriptionComplexAttributeImpl
(Collection<Property> properties, AttributeDescriptor descriptor, Identifier id) ComplexAttributeImpl
(Collection<Property> properties, ComplexType type, Identifier id) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Appends a property to this attribute's property list without incurring in unnecessary object allocation such as safe-copying the values list as insetValue(Collection)
Complete collection of properties.getProperties
(String name) Returns a subset of the properties of the complex attribute which match the specified name.getProperties
(Name name) Returns a subset of the properties of the complex attribute which match the specified name.getProperty
(String name) Returns single property of the complex attribute which matches the specified name.getProperty
(Name name) Returns single property of the complex attribute which matches the specified name.getType()
The type of the property.Collection<? extends Property>
getValue()
The value or content of the property.Internal helper method for getting at the properties without wrapping in unmodifiable collection.void
Override of setValue to convert the newValue to specified type if need be.void
setValue
(Collection<Property> newValue) Sets the contained properties of the complex attribute.Methods inherited from class AttributeImpl
equals, getDescriptor, getIdentifier, hashCode, parse, toString, validate
Methods inherited from class PropertyImpl
getName, getUserData, getUserData, isNillable
Methods inherited from interface Attribute
getDescriptor, getIdentifier
Methods inherited from interface ComplexAttribute
validate
Methods inherited from interface Property
getName, getUserData, hasUserData, isNillable
-
Constructor Details
-
ComplexAttributeImpl
public ComplexAttributeImpl(Collection<Property> properties, AttributeDescriptor descriptor, Identifier id) -
ComplexAttributeImpl
-
-
Method Details
-
getType
Description copied from interface:Property
The type of the property.The type contains information about the value or content of the property such as its java class.
This value is also available via
getDescriptor().getType()
.- Specified by:
getType
in interfaceAttribute
- Specified by:
getType
in interfaceComplexAttribute
- Specified by:
getType
in interfaceProperty
- Overrides:
getType
in classAttributeImpl
- Returns:
- The property type.
- See Also:
-
getValue
Description copied from interface:Property
The value or content of the property.The class of this object is defined by
getType().getBinding()
.This value may be
null
. In this casegetDescriptor().isNillable()
would betrue
.- Specified by:
getValue
in interfaceComplexAttribute
- Specified by:
getValue
in interfaceProperty
- Overrides:
getValue
in classPropertyImpl
- Returns:
- The value of the property.
-
getProperties
Description copied from interface:ComplexAttribute
Complete collection of properties.This method is a convenience method for calling (Collection
) getValue(). - Specified by:
getProperties
in interfaceComplexAttribute
- Returns:
- The complete collection of properties.
-
properties
Internal helper method for getting at the properties without wrapping in unmodifiable collection. -
getProperties
Description copied from interface:ComplexAttribute
Returns a subset of the properties of the complex attribute which match the specified name.The name parameter is matched against each contained
Property.getName()
, those that are equal are returned.- Specified by:
getProperties
in interfaceComplexAttribute
- Parameters:
name
- The name of the properties to return.- Returns:
- The collection of properties which match the specified name, or an empty collection if no such properties match.
-
findLast
- Returns:
- the first property in
getProperties()
reverse order whosename
equals the givenname
-
findAll
- Returns:
- all properties that match the provided predicate, may be empty, never
null
-
find
- Returns:
- the first property that matches the provided predicate, or
Optional.empty()
-
getProperties
Description copied from interface:ComplexAttribute
Returns a subset of the properties of the complex attribute which match the specified name.This method is a convenience for
ComplexAttribute.getProperties(Name)
in whichName.getNamespaceURI()
isnull
.Note: Special care should be taken when using this method in the case that two properties with the same local name but different namespace uri exist. For this reason using
ComplexAttribute.getProperties(Name)
is safer.- Specified by:
getProperties
in interfaceComplexAttribute
- Parameters:
name
- The local name of the properties to return.- Returns:
- The collection of properties which match the specified name, or an empty collection if no such properties match.
- See Also:
-
getProperty
Description copied from interface:ComplexAttribute
Returns single property of the complex attribute which matches the specified name.Note: This method is a convenience and care should be taken when calling it if more then a single property matches name. In such a case the first encountered property in which
Property.getName()
is equal to name is returned, and no order is guaranteed.This method is a safe convenience for:
getProperties(name).iterator().next()
.In the event that no property matches the specified name
null
is returned.- Specified by:
getProperty
in interfaceComplexAttribute
- Parameters:
name
- The name of the property to return.- Returns:
- The property matching the specified name, or
null
.
-
getProperty
Description copied from interface:ComplexAttribute
Returns single property of the complex attribute which matches the specified name.This method is a convenience for
ComplexAttribute.getProperty(Name)
in whichName.getNamespaceURI()
isnull
.Note: This method is a convenience and care should be taken when calling it if more then a single property matches name. In such a case the first encountered property in which
Property.getName()
is matches name is returned, and no order is guaranteed.Note: Special care should be taken when using this method in the case that two properties with the same local name but different namespace uri exist. For this reason using
ComplexAttribute.getProperties(Name)
is safer.- Specified by:
getProperty
in interfaceComplexAttribute
- Parameters:
name
- The local name of the property to return.- Returns:
- The property matching the specified name, or
null
.
-
setValue
Description copied from class:AttributeImpl
Override of setValue to convert the newValue to specified type if need be.- Specified by:
setValue
in interfaceProperty
- Overrides:
setValue
in classAttributeImpl
- Parameters:
newValue
- The new value of the property.- Throws:
IllegalArgumentException
IllegalStateException
-
setValue
Description copied from interface:ComplexAttribute
Sets the contained properties of the complex attribute.The values should match the structure defined by
getDescriptor()
.- Specified by:
setValue
in interfaceComplexAttribute
-
addValue
Appends a property to this attribute's property list without incurring in unnecessary object allocation such as safe-copying the values list as insetValue(Collection)
-