|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Property
An instance of a PropertyType
relised as a Attribute
or Association
.
A property is a wrapper around an arbitrary object or value. The value is
available via the getValue()
and setValue(Object)
.
Property property = ...; //set the value property.setValue( "foo" ); //get the value String value = (String) property.getValue();
Every property has a type. This PropertyType
defines information
about the property. This includes which java class the value of the property
is an instance of, any restrictions on the value, etc...
The type is available via the getType()
method.
Property property = ...; //get the type PropertyType type = property.getType(); //get the class of the value Class<String> valueClass = (Class<String>)type.getBinding();
A property can often be part of another entity such as a Feature
or ComplexAttribute
.
When this is the case, the relationship between the property and its "container" is described by
a PropertyDescriptor
.
The descriptor of a property defines things like nilablility, multiplicity,
etc... See the javadoc of PropertyDescriptor
for more details. The
descriptor is available via the getDescriptor()
method.
Property property = ...; //get the descriptor PropertyDescriptor descriptor = property.getDescriptor()l //is the value allowed to be null? descriptor.isNillable(); //how many instances of this property are allowed? descriptor.getMaxOccurs();
Method Summary | |
---|---|
PropertyDescriptor |
getDescriptor()
The PropertyDscriptor of the property, null if this is a top-level value. |
Name |
getName()
The name of the property with respect to its descriptor. |
PropertyType |
getType()
The type of the property. |
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. |
Method Detail |
---|
Object getValue()
The class of this object is defined by
getType().getBinding()
.
This value may be null
. In this case
getDescriptor().isNillable()
would be true
.
void setValue(Object newValue)
The class of newValue should be the same as or a subclass of
getType().getBinding()
.
newValue may be null
if
getDescriptor().isNillable()
is true
.
newValue
- The new value of the property.PropertyType getType()
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()
.
PropertyDescriptor getDescriptor()
PropertyDscriptor
of 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 Feature
or ComplexAttribute
.
ComplexAttribute
Name getName()
This method is convenience for getDescriptor().getName()
.
boolean isNillable()
null
is an acceptable value for the
property.
This method is convenience for getDescriptor().isNillable()
.
true
if the value of the property is allowed to be
null
, otherwise false
.Map<Object,Object> getUserData()
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" );
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |