Package org.geotools.feature
Class AttributeImpl
Object
PropertyImpl
AttributeImpl
- Direct Known Subclasses:
ComplexAttributeImpl,GeometryAttributeImpl
Simple, mutable class to store attributes.
- Author:
- Rob Hranac, VFNY, Chris Holmes, TOPP, Ian Schneider, Jody Garnett, Gabriel Roldan
-
Field Summary
FieldsFields inherited from class PropertyImpl
descriptor, value -
Constructor Summary
ConstructorsConstructorDescriptionAttributeImpl(Object content, AttributeDescriptor descriptor, Identifier id) AttributeImpl(Object content, AttributeType type, Identifier id) -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverride of equals.ThePropertyDscriptorof the property, null if this is a top-level value.Unique Identifier for the attribute.getType()The type of the property.inthashCode()Override of hashCode.protected ObjectAllows this Attribute to convert an argument to its prefered storage type.voidOverride of setValue to convert the newValue to specified type if need be.toString()voidvalidate()Check the attribute value against the constraints provided by the AttributeDescriptor.Methods inherited from class PropertyImpl
getName, getUserData, getUserData, getValue, isNillableMethods inherited from interface Property
getName, getUserData, getValue, hasUserData, isNillable
-
Field Details
-
id
id of the attribute.
-
-
Constructor Details
-
AttributeImpl
-
AttributeImpl
-
-
Method Details
-
getIdentifier
Description copied from interface:AttributeUnique Identifier for the attribute.This value is non-null in the case that
getType().isIdentifiable()istrue.- Specified by:
getIdentifierin interfaceAttribute- Returns:
- A unique identifier for the attribute, or
nullif the attribute is non-identifiable.
-
getDescriptor
Description copied from interface:PropertyThePropertyDscriptorof the property, null if this is a top-level value.The descriptor provides information about the property with respect to its containing entity (more often then not a
FeatureorComplexAttribute.- Specified by:
getDescriptorin interfaceAttribute- Specified by:
getDescriptorin interfaceProperty- Overrides:
getDescriptorin classPropertyImpl- Returns:
- The property descriptor, null if this is a top-level value.
- See Also:
-
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(). -
setValue
Override of setValue to convert the newValue to specified type if need be.- Specified by:
setValuein interfaceProperty- Overrides:
setValuein classPropertyImpl- Parameters:
newValue- The new value of the property.- Throws:
IllegalArgumentExceptionIllegalStateException
-
hashCode
public int hashCode()Override of hashCode.- Overrides:
hashCodein classPropertyImpl- Returns:
- hashCode for this object.
-
equals
Override of equals.- Overrides:
equalsin classPropertyImpl- Parameters:
obj- the object to be tested for equality.- Returns:
- whether other is equal to this attribute Type.
-
validate
public void validate()Description copied from interface:AttributeCheck the attribute value against the constraints provided by the AttributeDescriptor.Please note this method checks the value only - it should have the correct java binding, it should only be null if isNillable is true; and if a value is provided it should satisfy all of the restrictions provided.
To check the the number of times an attribute is used (minOccurs and maxOccurs) please use ComplexAttribute.validate().
-
toString
- Overrides:
toStringin classPropertyImpl
-
parse
Allows this Attribute to convert an argument to its prefered storage type. If no parsing is possible, returns the original value. If a parse is attempted, yet fails (i.e. a poor decimal format) throw the Exception. This is mostly for use internally in Features, but implementors should simply follow the rules to be safe.- Parameters:
value- the object to attempt parsing of.- Returns:
valueconverted to the preferred storage of thisAttributeType. If no parsing was possible then the same object is returned.- Throws:
IllegalArgumentException- if parsing is attempted and is unsuccessful.
-