Constructor and Description |
---|
ReadonlyAttributeDecorator(Attribute delegate) |
Modifier and Type | Method and Description |
---|---|
AttributeDescriptor |
getDescriptor()
Override of
Property.getDescriptor() which type narrows to AttributeDescriptor . |
Identifier |
getIdentifier()
Unique Identifier for the attribute.
|
Name |
getName()
The name of the property with respect to its descriptor.
|
AttributeType |
getType()
Override of
Property.getType() which type narrows to AttributeType . |
Map<Object,Object> |
getUserData()
A map of "user data" which enables applications to store "application-specific" information
against a property.
|
Object |
getValue()
The value or content of the property.
|
boolean |
isNillable()
Flag indicating if
null is an acceptable value for the property. |
void |
setValue(Object newValue)
Sets the value or content of the property.
|
void |
validate()
Check the attribute value against the constraints provided by the AttributeDescriptor.
|
public ReadonlyAttributeDecorator(Attribute delegate)
public AttributeType getType()
Attribute
Property.getType()
which type narrows to AttributeType
.getType
in interface Attribute
getType
in interface Property
Property.getType()
public Identifier getIdentifier()
Attribute
This value is non-null in the case that getType().isIdentifiable()
is
true
.
getIdentifier
in interface Attribute
null
if the attribute is
non-identifiable.public Object getValue()
Property
The class of this object is defined by getType().getBinding()
.
This value may be null
. In this case getDescriptor().isNillable()
would be true
.
public void setValue(Object newValue) throws IllegalArgumentException
Property
The class of newValue should be the same as or a subclass of
getType().getBinding()
.
newValue may be null
if getDescriptor().isNillable()
is
true
.
setValue
in interface Property
newValue
- The new value of the property.IllegalArgumentException
public AttributeDescriptor getDescriptor()
Attribute
Property.getDescriptor()
which type narrows to AttributeDescriptor
.getDescriptor
in interface Attribute
getDescriptor
in interface Property
Property.getDescriptor()
public Name getName()
Property
This method is convenience for getDescriptor().getName()
.
public Map<Object,Object> getUserData()
Property
An example of information that may wish to be stored along with an attribute could be its srs information (in the case of a geometric attribute ).
GeometryAttribute attribute = ...;
//set the crs
CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
attribute.setCRS( crs );
//set the srs
attribute.getUserData().put( "srs", "EPSG:4326" );
getUserData
in interface Property
public boolean isNillable()
Property
null
is an acceptable value for the property.
This method is convenience for getDescriptor().isNillable()
.
isNillable
in interface Property
true
if the value of the property is allowed to be null
,
otherwise false
.public void validate()
Attribute
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().
Copyright © 1996–2019 Geotools. All rights reserved.