Interface Property
-
- All Known Subinterfaces:
Association
,Attribute
,ComplexAttribute
,Feature
,GeometryAttribute
,SimpleFeature
- All Known Implementing Classes:
AssociationImpl
,AttributeImpl
,ComplexAttributeImpl
,DecoratingFeature
,FeatureImpl
,GeometryAttributeImpl
,JDBCFeatureReader.ResultSetFeature
,MongoDBObjectFeature
,MongoFeature
,PreGeneralizedSimpleFeature
,PropertyImpl
,ReadonlyAttributeDecorator
,SimpleFeatureImpl
public interface Property
An instance of aPropertyType
relised as aAttribute
orAssociation
.A property is a wrapper around an arbitrary object or value. The value is available via the
getValue()
andsetValue(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 thegetType()
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
orComplexAttribute
. When this is the case, the relationship between the property and its "container" is described by aPropertyDescriptor
. The descriptor of a property defines things like nilablility, multiplicity, etc... See the javadoc ofPropertyDescriptor
for more details. The descriptor is available via thegetDescriptor()
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();
- Author:
- Jody Garnett (Refractions Research), Justin Deoliveira (The Open Planning Project)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description PropertyDescriptor
getDescriptor()
ThePropertyDscriptor
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.default boolean
hasUserData()
Returns true if the property has a user data map.boolean
isNillable()
Flag indicating ifnull
is an acceptable value for the property.void
setValue(Object newValue)
Sets the value or content of the property.
-
-
-
Method Detail
-
getValue
Object getValue()
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
.- Returns:
- The value of the property.
-
setValue
void setValue(Object newValue)
Sets the value or content of the property.The class of newValue should be the same as or a subclass of
getType().getBinding()
.newValue may be
null
ifgetDescriptor().isNillable()
istrue
.- Parameters:
newValue
- The new value of the property.
-
getType
PropertyType getType()
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()
.- Returns:
- The property type.
-
getDescriptor
PropertyDescriptor getDescriptor()
ThePropertyDscriptor
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
orComplexAttribute
.- Returns:
- The property descriptor, null if this is a top-level value.
- See Also:
ComplexAttribute
-
getName
Name getName()
The name of the property with respect to its descriptor.This method is convenience for
getDescriptor().getName()
.- Returns:
- name of the property.
-
isNillable
boolean isNillable()
Flag indicating ifnull
is an acceptable value for the property.This method is convenience for
getDescriptor().isNillable()
.- Returns:
true
if the value of the property is allowed to benull
, otherwisefalse
.
-
getUserData
Map<Object,Object> getUserData()
A map of "user data" which enables applications to store "application-specific" information against a 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" );
- Returns:
- A map of user data.
-
hasUserData
default boolean hasUserData()
Returns true if the property has a user data map. Can be used to avoid instantiation of Map object in cases where the main code paths won't have any.- Returns:
- True if there is any user data, false otherwise
-
-