Class ComplexAttributeImpl
- All Implemented Interfaces:
Attribute,ComplexAttribute,Property
- Direct Known Subclasses:
FeatureImpl
-
Field Summary
Fields inherited from class AttributeImpl
idFields 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 TypeMethodDescriptionvoidAppends 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.voidOverride of setValue to convert the newValue to specified type if need be.voidsetValue(Collection<Property> newValue) Sets the contained properties of the complex attribute.Methods inherited from class AttributeImpl
equals, getDescriptor, getIdentifier, hashCode, parse, toString, validateMethods inherited from class PropertyImpl
getName, getUserData, getUserData, isNillableMethods inherited from interface Attribute
getDescriptor, getIdentifierMethods inherited from interface ComplexAttribute
validateMethods 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:PropertyThe 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:
getTypein interfaceAttribute- Specified by:
getTypein interfaceComplexAttribute- Specified by:
getTypein interfaceProperty- Overrides:
getTypein classAttributeImpl- Returns:
- The property type.
- See Also:
-
getValue
Description copied from interface:PropertyThe 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:
getValuein interfaceComplexAttribute- Specified by:
getValuein interfaceProperty- Overrides:
getValuein classPropertyImpl- Returns:
- The value of the property.
-
getProperties
Description copied from interface:ComplexAttributeComplete collection of properties.This method is a convenience method for calling (Collection
) getValue(). - Specified by:
getPropertiesin 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:ComplexAttributeReturns 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:
getPropertiesin 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 whosenameequals 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:ComplexAttributeReturns 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:
getPropertiesin 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:ComplexAttributeReturns 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
nullis returned.- Specified by:
getPropertyin interfaceComplexAttribute- Parameters:
name- The name of the property to return.- Returns:
- The property matching the specified name, or
null.
-
getProperty
Description copied from interface:ComplexAttributeReturns 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:
getPropertyin 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:AttributeImplOverride of setValue to convert the newValue to specified type if need be.- Specified by:
setValuein interfaceProperty- Overrides:
setValuein classAttributeImpl- Parameters:
newValue- The new value of the property.- Throws:
IllegalArgumentExceptionIllegalStateException
-
setValue
Description copied from interface:ComplexAttributeSets the contained properties of the complex attribute.The values should match the structure defined by
getDescriptor().- Specified by:
setValuein 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)
-