org.geotools.feature
Class MultiAttributeType

java.lang.Object
  extended byorg.geotools.feature.DefaultAttributeType
      extended byorg.geotools.feature.MultiAttributeType
All Implemented Interfaces:
AttributeType

public class MultiAttributeType
extends DefaultAttributeType

Class to handle more than one occurance of an attribute. There may be better ways to do this, but this seems to work.

Version:
$Id: MultiAttributeType.java 17701 2006-01-23 00:00:51Z desruisseaux $
Author:
Chris Holmes

Field Summary
 
Fields inherited from class org.geotools.feature.DefaultAttributeType
defaultValue, max, min, name, nillable, type
 
Fields inherited from interface org.geotools.feature.AttributeType
UNBOUNDED
 
Constructor Summary
MultiAttributeType(AttributeType validator)
          Constructor with validator.
MultiAttributeType(AttributeType validator, int maxOccur)
          Constructor with validator and maxOccurs
MultiAttributeType(AttributeType validator, int maxOccur, int minOccur)
          Constructor with validator, minOccurs and maxOccurs
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this object.
 int getMaxOccurs()
          Gets the maxOccur of this attribute.
 int getMinOccurs()
          Gets the minimum number of elements that pass the validator that must be in the list to validate.
 boolean isGeometry()
          Returns whether the attribute is a geometry.
 java.lang.Object parse(java.lang.Object value)
          If a single object is passed in then it is parsed into a list with just it as the element.
 java.lang.String toString()
          Gets a representation of this object as a string.
 void validate(java.lang.Object attribute)
          Whether the tested object is a Feature and its attributes validate against the featureType.
 
Methods inherited from class org.geotools.feature.DefaultAttributeType
createDefaultValue, duplicate, equals, getName, getRestriction, getType, hashCode, isNillable
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiAttributeType

public MultiAttributeType(AttributeType validator)
Constructor with validator.

Parameters:
validator - Name of this attribute.

MultiAttributeType

public MultiAttributeType(AttributeType validator,
                          int maxOccur)
Constructor with validator and maxOccurs

Parameters:
validator - Name of this attribute.
maxOccur - Number of instances of this attribute in the schema.

MultiAttributeType

public MultiAttributeType(AttributeType validator,
                          int maxOccur,
                          int minOccur)
Constructor with validator, minOccurs and maxOccurs

Parameters:
validator - Name of this attribute.
maxOccur - Number of instances of this attribute in the schema.
minOccur - Class type of this attribute.
Method Detail

getMaxOccurs

public int getMaxOccurs()
Gets the maxOccur of this attribute.

Specified by:
getMaxOccurs in interface AttributeType
Overrides:
getMaxOccurs in class DefaultAttributeType
Returns:
MaxOccur.

getMinOccurs

public int getMinOccurs()
Gets the minimum number of elements that pass the validator that must be in the list to validate.

Specified by:
getMinOccurs in interface AttributeType
Overrides:
getMinOccurs in class DefaultAttributeType
Returns:
MaxOccur.

isGeometry

public boolean isGeometry()
Returns whether the attribute is a geometry. Should this be false? Even if the attributes are geometries? Because this itself isn't actually a geometry, so it can't be used as a geometry.

Overrides:
isGeometry in class DefaultAttributeType
Returns:
true if the attribute's type is a geometry.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of this object.

Returns:
a copy of this attribute type.
Throws:
java.lang.CloneNotSupportedException - if clone is not supported.

validate

public void validate(java.lang.Object attribute)
              throws java.lang.IllegalArgumentException
Whether the tested object is a Feature and its attributes validate against the featureType. An IllegalArgumentException reporting the error in validation is thrown if validation fails..

Specified by:
validate in interface AttributeType
Overrides:
validate in class DefaultAttributeType
Parameters:
attribute - The object to be tested for validity.
Throws:
java.lang.IllegalArgumentException - if the object does not validate.

parse

public java.lang.Object parse(java.lang.Object value)
                       throws java.lang.IllegalArgumentException
If a single object is passed in then it is parsed into a list with just it as the element. If an array is passed in then it is turned into a list.

Specified by:
parse in interface AttributeType
Overrides:
parse in class DefaultAttributeType
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:
java.lang.IllegalArgumentException - if parsing is attempted and is unsuccessful.
Task:
REVISIT: implement this method as described in this comment.

toString

public java.lang.String toString()
Gets a representation of this object as a string.

Overrides:
toString in class DefaultAttributeType
Returns:
A representation of this object as a string


Copyright © GeoTools. All Rights Reserved.