Interface PropertyType
-
- All Known Subinterfaces:
AssociationType
,AttributeType
,ChoiceAttributeType
,ChoiceGeometryType
,ComplexType
,FeatureType
,GeometryType
,OperationType
,SimpleFeatureType
- All Known Implementing Classes:
AbstractLazyAttributeTypeImpl
,AbstractLazyComplexTypeImpl
,AssociationTypeImpl
,AttributeTypeImpl
,AttributeTypeProxy
,ChoiceGeometryTypeImpl
,ComplexFeatureTypeImpl
,ComplexTypeImpl
,ComplexTypeProxy
,FeatureTypeImpl
,FeatureTypeProxy
,GeometryTypeImpl
,GeometryTypeProxy
,NonFeatureTypeProxy
,PropertyTypeImpl
,SimpleFeatureTypeImpl
,UniqueNameFeatureTypeImpl
,VPFFeatureClass
,VPFFeatureType
public interface PropertyType
The type of a Property.A property type defines information about the value of a property. This includes:
- java class of the value of the property ((also known as the property "binding")
- any restrictions on the value of the property
- a description of the property
- if the type is abstract or not
Binding
ThegetBinding()
method returns the java class of which the value of the property is an instance of.Property property = ...; property.getType().getBinding().isAssignableFrom(property.getValue().getClass());
Restrictions
ThegetRestrictions()
method returns a set ofFilter
objects which define additional restrictions on the value of the property.Property property = ...; for ( Filter restriction : property.getType().getRestrictions() ) { restriction.evaluate( property ) == true; }
Inheritance
A property type may extend from another property type. When this occurs any restrictions defined by the parent type are inherited by the child type. The binding declared by the super type may or may not be a super class of the binding declared by the child type.Abstract Types
A property type may be abstract similar to how a java class can be abstract. Such property types are usually not referenced directly by a descriptor, but usually are the parent type of a non-abstract property type.Example
Property, PropertyDescriptor, and PropertyType are very similar to concepts encountered in xml schema. Consider the following xml schema:< simpleType name="number"/> < simpleType name="integer"/> < complexType name="myComplexType"/> <element name="foo" type="integer"/> </complexType>
In the above, "number", "integer", and "myComplexType" all map to PropertyType. While "foo" maps to a PropertyDescriptor. Consider a complex attribute which is of type "myComplexType:ComplexAttribute complexAttribute = ...; ComplexType complexType = complexAttribute.getType(); complexType.getName().getLocalPart() == "myComplexType"; //the property descriptor PropertyDescriptor propertyDescriptor = complexType.getProperty( "foo" ); propertyDescriptor.getName().getLocalPart() == "foo"; //the property type PropertyType propertyType = propertyDescriptor.getType(); propertyType.getName().getLocalPart() == "integer"; propertyType.getBinding() == Integer.class; propertyType.getSuper().getName().getLocalPart() == "number"; propertyType.getSuper().getBinding() == Number.class; //the property Property property = complexAttribute.getProperty( "foo" ); property.getDescriptor() == propertyDescriptor; property.getType() == propertyType; property.getName().getLocalPart() == "foo"; property.getValue() instanceof Integer;
- Author:
- Jody Garnett, Refractions Research, Inc., Justin Deoliveira, The Open Planning Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
equals(Object other)
Equality based on propertygetName()
.Class<?>
getBinding()
The java class that values of properties of the property type are bound to.InternationalString
getDescription()
Human readable description of this property type.Name
getName()
The name of the property type.List<Filter>
getRestrictions()
List of restrictions used define valid values for properties of this property type.PropertyType
getSuper()
The parent type of the property type.Map<Object,Object>
getUserData()
A map of "user data" which enables applications to store "application-specific" information against a property type.int
hashCode()
Hashcode override based ongetName()
.boolean
isAbstract()
Flag indicating if the type is abstract or not.
-
-
-
Method Detail
-
getName
Name getName()
The name of the property type.Note that this is not the same name as
Property.getName()
, which is the name of the instance of the type, not the type itself.The returned name is a qualified name made up of two parts. The first a namespace uri (
Name.getNamespaceURI()
, and the second a local part (Name.getLocalPart()
.This value is never
null
.- Returns:
- The name of the property type.
-
getBinding
Class<?> getBinding()
The java class that values of properties of the property type are bound to.This value is never
null
.- Returns:
- The binding of the property type.
-
getSuper
PropertyType getSuper()
The parent type of the property type.This method returns
null
if no super type is defined.The super type may contain additional restrictions to be considered against properties of the the property type.
- Returns:
- The parent or super type, or
null
.
-
isAbstract
boolean isAbstract()
Flag indicating if the type is abstract or not.- Returns:
true
if the type is abstract, otherwisefalse
.
-
getRestrictions
List<Filter> getRestrictions()
List of restrictions used define valid values for properties of this property type.Each restriction is a
Filter
object in which the property is passed through. IfFilter.evaluate(Object)
returnstrue
the restriction is met. Iffalse
is returned then the restriction has not been met and the property should be considered invalid. Remember to check getSuper().getRestrictions() as well.This method returns an empty set in the case of no restrictions and should not return
null
.- Returns:
- List
used to validate allowable values.
-
getDescription
InternationalString getDescription()
Human readable description of this property type.- Returns:
- Human readable description of this property type.
-
getUserData
Map<Object,Object> getUserData()
A map of "user data" which enables applications to store "application-specific" information against a property type.As an example, consider an application that builds a PropertyType from an xml schema. A useful bit of information to attach to the PropertyType is the original schema itself, in whatever construct it might be stored in:
XSDComplexTypeDefinition complexTypeDef = ...; PropertyType type = buildPropertyType( complexTypeDef ); type.getUserData().put( XSDComplexTypeDefintion.class, complexTypeDef );
- Returns:
- A map of user data.
-
-