|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.text.Format
com.davisor.data.Type
com.davisor.data.LocaleType
com.davisor.data.FormatType
com.davisor.data.SimpleNumberType
com.davisor.data.FloatType
com.davisor.data.EnumType
EnumType defines a base class for enumerated data types that
provide one-way mapping from integer indexes to enumerated values.
In particular, sub-classes are expected to define backend
implementation for the enumValue(int) method that does the
mapping.
EnumType supports number values of any number type, including
floating point values. In particular, EnumType inherits FloatType instead of for example IntegerType to allow
construction and interpolation of fraction values. Fraction values
are mapped to enumerated values by first trucating them to
corresponding integer values, and then mapping the results to
enumerated values.
FormatType.setFormat(java.util.Locale, java.lang.String),
EnumData,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class java.text.Format |
java.text.Format.Field |
| Field Summary | |
static java.lang.String |
TYPENAME
Type name ("ENUM"). |
| Fields inherited from class com.davisor.data.FloatType |
DEFAULT |
| Fields inherited from class com.davisor.data.FormatType |
M_pattern, M_sample |
| Fields inherited from class com.davisor.data.LocaleType |
DEFAULT_LOCALE, M_locale |
| Fields inherited from class com.davisor.data.Type |
METADATA_GROUP, METADATA_NAME, METADATA_PARENT, METADATA_SUBCHANNELS |
| Constructor Summary | |
|
EnumType(EnumType et)
Copy constructor. |
protected |
EnumType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.util.Locale locale,
java.lang.String pattern,
java.lang.Object sample)
Creates a new enum type. |
| Method Summary | |
abstract DataValue |
enumValue(int value)
Converts the index to an enumerated value. |
DataValue |
enumValue(int value,
DataValue defaultValue)
Converts the index to an enumerated or default value. |
float |
getCompatibility(java.lang.Class type)
Gets an estimate of how well this type could represent objects of the given class. |
int |
getSQLCode()
Gets the SQL type code, as defined by java.sql.Types. |
java.lang.Class |
getValueClass()
Gets value container class. |
java.lang.String |
stringValue(byte value)
Converts a byte value to a string. |
java.lang.String |
stringValue(double value)
Converts a double value to a string. |
java.lang.String |
stringValue(float value)
Converts a float value to a string. |
java.lang.String |
stringValue(int value)
Converts an integer value to a string. |
java.lang.String |
stringValue(long value)
Converts a long value to a string. |
java.lang.String |
stringValue(java.lang.Number value)
Converts a Number value to a string. |
java.lang.String |
stringValue(short value)
Converts a short value to a string. |
| Methods inherited from class com.davisor.data.FloatType |
dup, equals, toData, toData, toData, toData |
| Methods inherited from class com.davisor.data.SimpleNumberType |
byteValue, byteValue, createFormatter, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, numberValue, shortValue, shortValue, zero |
| Methods inherited from class com.davisor.data.FormatType |
clearFormatter, getFormat, getFormatter, getPattern, getSample, hashCode, setFormat, setFormat, setLocale, setPattern, setSample |
| Methods inherited from class com.davisor.data.LocaleType |
getLocale, setLocale |
| Methods inherited from class com.davisor.data.Type |
ceil, check, check, compare, create, create, create, create, create, dup, floor, format, getDataName, getId, getID, getMetaData, getMetaData, getSpecs, getSQLName, getSQLName, getTypeName, isNull, parseObject, register, register, setDataName, setId, setID, setMetaData, setMetaData, setSpecs, toString, toXML, xmlEnd, xmlStart |
| Methods inherited from class java.text.Format |
clone, format, formatToCharacterIterator, parseObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String TYPENAME
| Constructor Detail |
public EnumType(EnumType et)
protected EnumType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.util.Locale locale,
java.lang.String pattern,
java.lang.Object sample)
typeName - type namedataName - data name (may be null)id - type identity (may be null)metaData - type meta data map (may be null)locale - type locale (may be null)pattern - format pattern (may be null)sample - format sample (may be null)| Method Detail |
public java.lang.String stringValue(byte value)
throws InvalidDataException
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - the value to be converted
InvalidDataException - if the value cannot
be convertedstringValue(int)
public java.lang.String stringValue(double value)
throws InvalidDataException
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - the value to be converted
InvalidDataException - if the value cannot
be convertedstringValue(int)
public java.lang.String stringValue(float value)
throws InvalidDataException
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - the value to be converted
InvalidDataException - if the value cannot
be convertedstringValue(int)
public java.lang.String stringValue(int value)
throws InvalidDataException
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - the value to be converted
InvalidDataException - if the value cannot
be convertedenumValue(int)
public java.lang.String stringValue(long value)
throws InvalidDataException
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - the value to be converted
InvalidDataException - if the value cannot
be convertedstringValue(int)
public java.lang.String stringValue(short value)
throws InvalidDataException
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - the value to be converted
InvalidDataException - if the value cannot
be convertedFormatType.getFormatter()
public java.lang.String stringValue(java.lang.Number value)
throws InvalidDataException
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - the value to be converted
InvalidDataException - if the value cannot
be convertedstringValue(int)
public abstract DataValue enumValue(int value)
throws com.davisor.core.NotFoundException
value - index of an enumerated value
com.davisor.core.NotFoundException - the element with 'value' was not found
public DataValue enumValue(int value,
DataValue defaultValue)
value - index of an enumerated valuedefaultValue - value to return if enumerated value was not found
public float getCompatibility(java.lang.Class type)
getCompatibility in class Typetype - type to estimate
getValueClass()public int getSQLCode()
getSQLCode in class FloatTypepublic java.lang.Class getValueClass()
getValueClass in class FloatType
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||