| org.geotools.feature.AttributeType
All known Subclasses: org.geotools.feature.type.FeatureAttributeType, org.geotools.feature.type.ChoiceAttributeType, org.geotools.feature.type.ListAttributeType, org.geotools.feature.type.SetAttributeType, org.geotools.data.feature.adapter.GTAttributeTypeAdapter, org.geotools.feature.DefaultAttributeType, org.geotools.data.vpf.VPFColumn,
AttributeType | public interface AttributeType (Code) | |
Stores metadata about a single attribute object.
-
Name: A string that is used to reference the attribute.
-
Nillable: if nulls are allowed as this attribute.
-
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 author: Chris Holmes, TOPP version: $Id: AttributeType.java 26186 2007-07-10 02:18:59Z jdeolive $ |
Field Summary | |
public static int | UNBOUNDED Represents any number of elements. |
UNBOUNDED | public static int UNBOUNDED(Code) | | Represents any number of elements. Same '' in a reg-ex
|
createDefaultValue | Object createDefaultValue()(Code) | | Create a default value for this AttributeType. If the type is nillable,
the Object may or may not be null.
Default value, note may be null if isNillable is true |
duplicate | Object duplicate(Object src) throws IllegalAttributeException(Code) | | 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. Duplicate of provided object throws: IllegalAttributeException - If the src Object is not the correcttype. |
getBinding | Class getBinding()(Code) | | Gets the class/type/binding for this attribute.
This method is a replacement for
AttributeType.getType() in order to resolve
a naming conflict with the geoapi feature model.
See Also: AttributeDescriptor.getType since: 2.4 |
getLocalName | String getLocalName()(Code) | | Returns the unqualified name of this attribute.
This method is a replacement for
AttributeType.getName() in order to resolve
a naming conflict with the geoapi feature model.
See Also: PropertyDescriptor.getName since: 2.4 |
getMaxOccurs | int getMaxOccurs()(Code) | | Returns the Max number of occurences ...
|
getMinOccurs | int getMinOccurs()(Code) | | Returns the Min number of occurences ...
|
getRestriction | Filter getRestriction()(Code) | | This represents a Facet in XML schema ... for example can be used to
represent the max length of 20 for a string.
Filter, or Filter.INCLUDE if no restriction is needed. |
isNillable | boolean isNillable()(Code) | | Returns whether nulls are allowed for this attribute.
true if nulls are permitted, false otherwise. |
parse | Object parse(Object value) throws IllegalArgumentException(Code) | | 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. value converted to the preferred storage of thisAttributeType . If no parsing was possible thenthe same object is returned. throws: IllegalArgumentException - if parsing is attempted and isunsuccessful. |
validate | void validate(Object obj) throws IllegalArgumentException(Code) | | Whether the tested object passes the validity constraints of this
AttributeType. At a minimum it should be of the correct class
specified by
AttributeType.getType() , 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. |
|
|