org.geotools.data.wfs.feature
Class LenientAttribute

Object
  extended by PropertyImpl
      extended by LenientAttribute
All Implemented Interfaces:
Attribute, Property

public class LenientAttribute
extends PropertyImpl
implements Attribute

Simple, mutable class to store attributes - that does not validate!

Author:
Jody Garnett

Field Summary
protected  Identifier id
          id of the attribute.
 
Fields inherited from class PropertyImpl
descriptor, userData, value
 
Constructor Summary
LenientAttribute(Object content, AttributeDescriptor descriptor, String id)
           
LenientAttribute(Object content, AttributeType type, String id)
           
 
Method Summary
 boolean equals(Object obj)
          Override of equals.
 AttributeDescriptor getDescriptor()
          The PropertyDscriptor of the property, null if this is a top-level value.
 Identifier getIdentifier()
          Unique Identifier for the attribute.
 AttributeType getType()
          The type of the property.
 int hashCode()
          Override of hashCode.
 boolean isValid()
           
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()
          Check the attribute value against the constraints provided by the AttributeDescriptor.
 
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 final Identifier id
id of the attribute.

Constructor Detail

LenientAttribute

public LenientAttribute(Object content,
                        AttributeDescriptor descriptor,
                        String id)

LenientAttribute

public LenientAttribute(Object content,
                        AttributeType type,
                        String id)
Method Detail

getIdentifier

public Identifier getIdentifier()
Description copied from interface: Attribute
Unique Identifier for the attribute.

This value is non-null in the case that getType().isIdentifiable() is true.

Specified by:
getIdentifier in interface Attribute
Returns:
A unique identifier for the attribute, or null if the attribute is non-identifiable.

getDescriptor

public AttributeDescriptor getDescriptor()
Description copied from interface: Property
The PropertyDscriptor of the property, null if this is a top-level value.

The descriptor provides information about the property with respect to its containing entity (more often then not a Feature or ComplexAttribute.

Specified by:
getDescriptor in interface Attribute
Specified by:
getDescriptor in interface Property
Overrides:
getDescriptor in class PropertyImpl
Returns:
The property descriptor, null if this is a top-level value.
See Also:
ComplexAttribute

getType

public AttributeType getType()
Description copied from interface: Property
The type of the property.

The type contains information about the value or content of the property such as its java class.

This value is also available via getDescriptor().getType().

Specified by:
getType in interface Attribute
Specified by:
getType in interface Property
Overrides:
getType in class PropertyImpl
Returns:
The property type.
See Also:
Property.getType()

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
Parameters:
newValue - The new value of the property.
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.

isValid

public boolean isValid()

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.

validate

public void validate()
              throws IllegalAttributeException
Description copied from interface: Attribute
Check the attribute value against the constraints provided by the AttributeDescriptor.

Please note this method checks the value only - it should have the correct java binding, it should only be null if isNillable is true; and if a value is provided it should satisfy all of the restrictions provided.

To check the the number of times an attribute is used (minOccurs and maxOccurs) please use ComplexAttribute.validate().

Specified by:
validate in interface Attribute
Throws:
IllegalAttributeException


Copyright © 1996-2014 Geotools. All Rights Reserved.