org.opengis.feature.type
Interface PropertyDescriptor

All Known Subinterfaces:
AssociationDescriptor, AttributeDescriptor, ChoiceAttributeType, ChoiceGeometryType, GeometryDescriptor, Operation
All Known Implementing Classes:
AssociationDescriptorImpl, AttributeDescriptorImpl, ChoiceGeometryTypeImpl, GeometryDescriptorImpl, PropertyDescriptorImpl

public interface PropertyDescriptor

Describes a Property, and how it relates to its containing entity, which is often a ComplexAttribute.

A property descriptor defines the following about the property:


The concept of a descriptor is similar to that of a element declaration in xml. Consider the following xml schema definition:

   <complexType name="someComplexType">
     <sequence>
       <element name="foo" minOccurs="2" maxOccurs="4" type="xs:string" nillable="false"/>
     <sequence>
   <complexType>
 

In the above, the element declaration named "foo" maps to a property descriptor. From the above schema, the following property descriptor would result:
  //the complex type
  ComplexType complexType = ...;

  //get the descriptor
  PropertyDescriptor descriptor = complexType.getProperty( "foo" );

  //make the following assertions
  descriptor.getName().getLocalPart().equals( "foo" );

  descriptor.getType().getName().getNamespaceURI().equals( "http://www.w3.org/2001/XMLSchema" )
  descriptor.getType().getName().getLocalPart().equals( "string" );
  descriptor.getMinOccurs() == 2;
  descriptor.getMaxOccurs() == 4;
  descriptor.isNillable() == true;

  //the complex attribute
  ComplexAttribute complexAttribute = ...
  complexAttribute.getType() == complexType;

  //get the properties
  Collection properties = complexAttribute.getProperties( "foo" );

  //make assertions about properties
  properties.size() >= 2;  //minOccurs = 2
  properties.size() <= 4; //maxOccurs = 4

  for ( Property p : properties ) {
      p.getDescriptor() == descriptor

      p.getValue() != null; //nilable = false
      p.getType().getBinding() == String.class; //type = xs:string
      p.getValue() instanceof String; //type = xs:string
  }
 

Author:
Jody Garnett, Refractions Research, Justin Deoliveira, The Open Planning Project

Method Summary
 int getMaxOccurs()
          The maximum number of occurrences of the property within its containing entity.
 int getMinOccurs()
          The minimum number of occurrences of the property within its containing entity.
 Name getName()
          The name of the property defined by the descriptor, with respect to its containing type or entity..
 PropertyType getType()
          The type of the property defined by the descriptor.
 Map<Object,Object> getUserData()
          A map of "user data" which enables applications to store "application-specific" information against a property descriptor.
 boolean isNillable()
          Flag indicating if null is an allowable value for the property.
 

Method Detail

getType

PropertyType getType()
The type of the property defined by the descriptor.

This value should never be null. The type contains information about the value of the property such as its java class.


getName

Name getName()
The name of the property defined by the descriptor, with respect to its containing type or entity..

This value may be null in some instances. Also note that this is not the same name as getType().getName(). The former is the name of the instance, the latter is the name of the type of the instance.


getMinOccurs

int getMinOccurs()
The minimum number of occurrences of the property within its containing entity.

This value is always an integer greater than or equal to zero.

Returns:
An integer >= 0

getMaxOccurs

int getMaxOccurs()
The maximum number of occurrences of the property within its containing entity.

This value is a positive integer. A value of -1 means that the max number of occurrences is unbounded.

Returns:
An integer >= 0, or -1.

isNillable

boolean isNillable()
Flag indicating if null is an allowable value for the property.

Returns:
true if the property is allowed to be null, otherwise false.

getUserData

Map<Object,Object> getUserData()
A map of "user data" which enables applications to store "application-specific" information against a property descriptor.

Returns:
A map of user data.


Copyright © 1996-2014 Geotools. All Rights Reserved.