org.geotools.feature
Interface AttributeType

All Superinterfaces:
AttributeDescriptor, PropertyDescriptor
All Known Subinterfaces:
FeatureAttributeType, GeometryAttributeType, PrimativeAttributeType
All Known Implementing Classes:
ChoiceAttributeType, ChoiceAttributeType.Geometric, DefaultAttributeType, FeatureAttributeType, GeometricAttributeType, ListAttributeType, MultiAttributeType, NestedAttributeType, NumericAttributeType, SetAttributeType, TemporalAttributeType, TextualAttributeType

Deprecated. use AttributeDescriptor.

public interface AttributeType
extends AttributeDescriptor

Stores metadata about a single attribute object.

  1. Name: A string that is used to reference the attribute.
  2. Nillable: if nulls are allowed as this attribute.
  3. Type: The expected Java class of this attribute.

AttributeTypes must also provide the validate(Object obj) method, which determines whether a given object matches the constraints imposed by the AttributeType. In a default attribute this will simply be that it is of the correct class and non-null (or null if isNillable is true). More complex AttributeTypes can impose any restrictions that they like. Nested FeatureTypes are an example of this, as they need to check that the Feature object matches all its constraints, not that it is just of class Feature.

Additionally, implementors may use the parse method to convert an object to its preferred storage type. If an implementor does not choose to provide any functionality for this method they should simple return the object passed in. If parsing is attempted and not successful, then an exception should be thrown. This method is primarily used by FeatureType to try to convert objects to the correct storage type, such as a string of a double when the AttributeType requires a Double.

Author:
Rob Hranac, VFNY, Chris Holmes, TOPP
Module:
modules/library/legacy (gt-legacy.jar)

Field Summary
static int UNBOUNDED
          Deprecated. Represents any number of elements.
 
Method Summary
 Object createDefaultValue()
          Deprecated. Create a default value for this AttributeType.
 Object duplicate(Object src)
          Deprecated. Create a duplicate value of the passed Object.
 Class getBinding()
          Deprecated. Gets the class/type/binding for this attribute.
 String getLocalName()
          Deprecated. Returns the unqualified name of this attribute.
 int getMaxOccurs()
          Deprecated. Returns the Max number of occurences ...
 int getMinOccurs()
          Deprecated. Returns the Min number of occurences ...
 Filter getRestriction()
          Deprecated. This represents a Facet in XML schema ... for example can be used to represent the max length of 20 for a string.
 boolean isNillable()
          Deprecated. Returns whether nulls are allowed for this attribute.
 Object parse(Object value)
          Deprecated. Allows this AttributeType to convert an argument to its prefered storage type.
 void validate(Object obj)
          Deprecated. Whether the tested object passes the validity constraints of this AttributeType.
 
Methods inherited from interface AttributeDescriptor
getDefaultValue, getType
 
Methods inherited from interface PropertyDescriptor
getName, getUserData
 

Field Detail

UNBOUNDED

static final int UNBOUNDED
Deprecated. 
Represents any number of elements. Same '' in a reg-ex

See Also:
Constant Field Values
Method Detail

getLocalName

String getLocalName()
Deprecated. 
Returns the unqualified name of this attribute.

This method is a replacement for PropertyDescriptor.getName() in order to resolve a naming conflict with the geoapi feature model.

Specified by:
getLocalName in interface AttributeDescriptor
Since:
2.4
See Also:
PropertyDescriptor.getName()

getBinding

Class getBinding()
Deprecated. 
Gets the class/type/binding for this attribute.

This method is a replacement for AttributeDescriptor.getType() in order to resolve a naming conflict with the geoapi feature model.

Since:
2.4
See Also:
AttributeDescriptor.getType()

getRestriction

Filter getRestriction()
Deprecated. 
This represents a Facet in XML schema ... for example can be used to represent the max length of 20 for a string.

Returns:
Filter, or Filter.INCLUDE if no restriction is needed.

isNillable

boolean isNillable()
Deprecated. 
Returns whether nulls are allowed for this attribute.

Specified by:
isNillable in interface PropertyDescriptor
Returns:
true if nulls are permitted, false otherwise.

getMinOccurs

int getMinOccurs()
Deprecated. 
Returns the Min number of occurences ...

Specified by:
getMinOccurs in interface PropertyDescriptor

getMaxOccurs

int getMaxOccurs()
Deprecated. 
Returns the Max number of occurences ...

Specified by:
getMaxOccurs in interface PropertyDescriptor

parse

Object parse(Object value)
             throws IllegalArgumentException
Deprecated. 
Allows this AttributeType to convert an argument to its prefered storage type. If no parsing is possible, returns the original value. If a parse is attempted, yet fails (i.e. a poor decimal format) throw the Exception. This is mostly for use internally in Features, but implementors should simply follow the rules to be safe.

Parameters:
value - the object to attempt parsing of.
Returns:
value converted to the preferred storage of this AttributeType. If no parsing was possible then the same object is returned.
Throws:
IllegalArgumentException - if parsing is attempted and is unsuccessful.

validate

void validate(Object obj)
              throws IllegalArgumentException
Deprecated. 
Whether the tested object passes the validity constraints of this AttributeType. At a minimum it should be of the correct class specified by getBinding(), non-null if isNillable is false, and a geometry if isGeometry is true. If The object does not validate then an IllegalArgumentException reporting the error in validation should be thrown.

Parameters:
obj - The object to be tested for validity.
Throws:
IllegalArgumentException - if the object does not validate.

duplicate

Object duplicate(Object src)
                 throws IllegalAttributeException
Deprecated. 
Create a duplicate value of the passed Object. For immutable Objects, it is not neccessary to create a new Object.

Parameters:
src - The Object to duplicate.
Returns:
Duplicate of provided object
Throws:
IllegalAttributeException - If the src Object is not the correct type.

createDefaultValue

Object createDefaultValue()
Deprecated. 
Create a default value for this AttributeType. If the type is nillable, the Object may or may not be null.

Returns:
Default value, note may be null if isNillable is true


Copyright © 1996-2009 Geotools. All Rights Reserved.