|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Stores metadata about a single attribute object.
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.
Field Summary | |
static int |
UNBOUNDED
Represents any number of elements. |
Method Summary | |
java.lang.Object |
createDefaultValue()
Create a default value for this AttributeType. |
java.lang.Object |
duplicate(java.lang.Object src)
Create a duplicate value of the passed Object. |
int |
getMaxOccurs()
Returns the Max number of occurences ... |
int |
getMinOccurs()
Returns the Min number of occurences ... |
java.lang.String |
getName()
Gets the name of this attribute. |
Filter |
getRestriction()
This represents a Facet in XML schema ... for example can be used to represent the max length of 20 for a string. |
java.lang.Class |
getType()
Gets the type of this attribute. |
boolean |
isNillable()
Returns whether nulls are allowed for this attribute. |
java.lang.Object |
parse(java.lang.Object value)
Allows this AttributeType to convert an argument to its prefered storage type. |
void |
validate(java.lang.Object obj)
Whether the tested object passes the validity constraints of this AttributeType. |
Field Detail |
public static final int UNBOUNDED
Method Detail |
public java.lang.String getName()
public java.lang.Class getType()
public Filter getRestriction()
public boolean isNillable()
public int getMinOccurs()
public int getMaxOccurs()
public java.lang.Object parse(java.lang.Object value) throws java.lang.IllegalArgumentException
value
- the object to attempt parsing of.
value
converted to the preferred storage of this
AttributeType
. If no parsing was possible then
the same object is returned.
java.lang.IllegalArgumentException
- if parsing is attempted and is
unsuccessful.public void validate(java.lang.Object obj) throws java.lang.IllegalArgumentException
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.
obj
- The object to be tested for validity.
java.lang.IllegalArgumentException
- if the object does not validate.public java.lang.Object duplicate(java.lang.Object src) throws IllegalAttributeException
src
- The Object to duplicate.
IllegalAttributeException
- If the src Object is not the correct
type.public java.lang.Object createDefaultValue()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |