org.geotools.feature.type
Class NumericAttributeType
java.lang.Object
org.geotools.feature.DefaultAttributeType
org.geotools.feature.type.NumericAttributeType
- All Implemented Interfaces:
- AttributeType, PrimativeAttributeType
- public class NumericAttributeType
- extends DefaultAttributeType
- implements PrimativeAttributeType
Class that represents a Numeric.
- Author:
- Ian Schneider, Chris Holmes, TOPP
Constructor Summary |
NumericAttributeType(java.lang.String name,
java.lang.Class type,
boolean nillable,
int min,
int max,
java.lang.Object defaultValue,
Filter filter)
Constructor with name, type and nillable. |
NumericAttributeType(java.lang.String name,
java.lang.Class type,
boolean nillable,
java.lang.Object defaultValue,
Filter filter)
|
Method Summary |
protected java.lang.Object |
convertNumber(java.lang.Number number)
|
java.lang.Object |
duplicate(java.lang.Object o)
Duplicate the given Object. |
Filter |
getRestriction()
This provides access to the immutable restriction for this attribute
type. |
java.lang.Object |
parse(java.lang.Object value)
Allows this AttributeType to convert an argument to its prefered storage
type. |
protected java.lang.Object |
parseFromString(java.lang.String value)
|
Methods inherited from class org.geotools.feature.DefaultAttributeType |
createDefaultValue, equals, getMaxOccurs, getMinOccurs, getName, getType, hashCode, isGeometry, isNillable, toString, validate |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
NumericAttributeType
public NumericAttributeType(java.lang.String name,
java.lang.Class type,
boolean nillable,
int min,
int max,
java.lang.Object defaultValue,
Filter filter)
throws java.lang.IllegalArgumentException
- Constructor with name, type and nillable. Type should always be a
Number class.
- Parameters:
name
- Name of this attribute.type
- Class type of this attribute.nillable
- If nulls are allowed for the attribute of this type.min
- DOCUMENT ME!max
- DOCUMENT ME!defaultValue
- default value when none is suppled
- Throws:
java.lang.IllegalArgumentException
- is type is not a Number.- Task:
- REVISIT: protected?
NumericAttributeType
public NumericAttributeType(java.lang.String name,
java.lang.Class type,
boolean nillable,
java.lang.Object defaultValue,
Filter filter)
throws java.lang.IllegalArgumentException
parse
public java.lang.Object parse(java.lang.Object value)
throws java.lang.IllegalArgumentException
- 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.
- 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: When type is Number, should we always be using Double?
(What else would we do? - IanS)
duplicate
public java.lang.Object duplicate(java.lang.Object o)
- Duplicate the given Object. In this case, since Number classes are
immutable, lets return the Object.
- Specified by:
duplicate
in interface AttributeType
- Overrides:
duplicate
in class DefaultAttributeType
- Parameters:
o
- DOCUMENT ME!
- Returns:
- DOCUMENT ME!
parseFromString
protected java.lang.Object parseFromString(java.lang.String value)
throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
convertNumber
protected java.lang.Object convertNumber(java.lang.Number number)
getRestriction
public Filter getRestriction()
- Description copied from interface:
PrimativeAttributeType
- This provides access to the immutable restriction for this attribute
type. This restriction should be applied when real data hits instances
of this class. This mapps to the idea of a Facet in xml schema, or
restrictions in a database.
Examples may include Length <= 20 (VARCHAR 20)
The Default value is Filter.ALL
- Specified by:
getRestriction
in interface PrimativeAttributeType
- Overrides:
getRestriction
in class DefaultAttributeType
Copyright © GeoTools. All Rights Reserved.