org.geotools.feature
Class AttributeImpl

Object
  extended by PropertyImpl
      extended by AttributeImpl
All Implemented Interfaces:
Attribute, Property
Direct Known Subclasses:
ComplexAttributeImpl, GeometryAttributeImpl

public class AttributeImpl
extends PropertyImpl
implements Attribute

Simple, mutable class to store attributes.

Author:
Rob Hranac, VFNY, Chris Holmes, TOPP, Ian Schneider, Jody Garnett, Gabriel Roldan
Module:
modules/library/main (gt-main.jar)

Field Summary
protected  Identifier id
          id of the attribute.
 
Fields inherited from class PropertyImpl
descriptor, userData, value
 
Constructor Summary
AttributeImpl(Object content, AttributeDescriptor descriptor, Identifier id)
           
AttributeImpl(Object content, AttributeType type, Identifier id)
           
 
Method Summary
 boolean equals(Object obj)
          Override of equals.
 AttributeDescriptor getDescriptor()
           
 Identifier getIdentifier()
           
 AttributeType getType()
           
 int hashCode()
          Override of hashCode.
protected  Object parse(Object value)
          Allows this Attribute to convert an argument to its prefered storage type.
 void setValue(Object newValue)
          Override of setValue to convert the newValue to specified type if need be.
 String toString()
           
 void validate()
           
 
Methods inherited from class PropertyImpl
getName, getUserData, getValue, isNillable
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Property
getName, getUserData, getValue, isNillable
 

Field Detail

id

protected Identifier id
id of the attribute.

Constructor Detail

AttributeImpl

public AttributeImpl(Object content,
                     AttributeDescriptor descriptor,
                     Identifier id)

AttributeImpl

public AttributeImpl(Object content,
                     AttributeType type,
                     Identifier id)
Method Detail

getIdentifier

public Identifier getIdentifier()
Specified by:
getIdentifier in interface Attribute

getDescriptor

public AttributeDescriptor getDescriptor()
Specified by:
getDescriptor in interface Attribute
Specified by:
getDescriptor in interface Property
Overrides:
getDescriptor in class PropertyImpl

getType

public AttributeType getType()
Specified by:
getType in interface Attribute
Specified by:
getType in interface Property
Overrides:
getType in class PropertyImpl

setValue

public void setValue(Object newValue)
              throws IllegalArgumentException,
                     IllegalStateException
Override of setValue to convert the newValue to specified type if need be.

Specified by:
setValue in interface Property
Overrides:
setValue in class PropertyImpl
Throws:
IllegalArgumentException
IllegalStateException

hashCode

public int hashCode()
Override of hashCode.

Overrides:
hashCode in class PropertyImpl
Returns:
hashCode for this object.

equals

public boolean equals(Object obj)
Override of equals.

Overrides:
equals in class PropertyImpl
Parameters:
other - the object to be tested for equality.
Returns:
whether other is equal to this attribute Type.

validate

public void validate()
Specified by:
validate in interface Attribute

toString

public String toString()
Overrides:
toString in class PropertyImpl

parse

protected Object parse(Object value)
                throws IllegalArgumentException
Allows this Attribute 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.


Copyright © 1996-2009 Geotools. All Rights Reserved.