|
|||||||||||
| 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.CountType
CountType defines a data type that interprets repetitions of a counter token string as non-negative values. In other words, 'n' repetitions of a token equals integer value 'n'.
The default token string is "*", but it can be set to any string with the 'setSpecs' method.
CountData,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class java.text.Format |
java.text.Format.Field |
| Field Summary | |
static java.lang.String |
TOKEN
Default token ("*"). |
static java.lang.String |
TYPENAME
Type name ("COUNT"). |
| 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 | |
|
CountType()
Default constructor. |
|
CountType(CountType ct)
Copy constructor. |
|
CountType(java.lang.String dataName)
Creates a new default type with no identity. |
|
CountType(java.lang.String dataName,
java.lang.String id,
java.lang.String token)
Creates a new count type. |
protected |
CountType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.lang.String token)
Creates a new count type. |
| Method Summary | |
java.lang.Short |
countValue(java.lang.String stringValue,
java.text.ParsePosition status)
Convert string to a counter value. |
com.davisor.core.Dupable |
dup()
Makes a deep copy of this object. |
float |
getCompatibility(java.lang.Class type)
Gets an estimate of how well this type could represent objects of the given class. |
java.lang.String |
getSpecs()
Get the counter token string. |
int |
getSQLCode()
Gets SQL type code, as defined byt java.sql.Types. |
java.lang.String |
getToken()
Gets the current token string. |
java.lang.Class |
getValueClass()
Gets value container class. |
void |
setSpecs(java.lang.String specs)
Set the counter token string. |
java.lang.String |
stringValue(short value)
Convert an integer to concatenated token strings. |
DataValue |
toData(java.sql.CallableStatement statement,
int column)
Converts a callable statement variable to a data value. |
DataValue |
toData(java.lang.Object objectValue)
Converts an object to a data value. |
DataValue |
toData(java.sql.ResultSet resultSet,
int column)
Converts a result set column value to a data value. |
DataValue |
toData(java.lang.String stringValue,
java.text.ParsePosition status)
Converts a string to a data value. |
| Methods inherited from class com.davisor.data.SimpleNumberType |
byteValue, byteValue, createFormatter, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, numberValue, shortValue, shortValue, stringValue, stringValue, stringValue, stringValue, stringValue, stringValue, zero |
| Methods inherited from class com.davisor.data.FormatType |
clearFormatter, equals, 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, getSQLName, getSQLName, getTypeName, isNull, parseObject, register, register, setDataName, setId, setID, setMetaData, setMetaData, 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
public static final java.lang.String TOKEN
| Constructor Detail |
public CountType()
public CountType(CountType ct)
public CountType(java.lang.String dataName)
dataName - data name (may be null)
public CountType(java.lang.String dataName,
java.lang.String id,
java.lang.String token)
This is the constructor the SQL type mapper Type.create(Integer,String,String,String) method will call to
create a type that matches given SQL type.
dataName - data name (may be null)id - type identity (may be null)token - token string
protected CountType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.lang.String token)
typeName - type namedataName - data name (may be null)id - type identity (may be null)metaData - type meta data map (may be null)token - token string| Method Detail |
public com.davisor.core.Dupable dup()
dup in interface com.davisor.core.Dupabledup in class Typepublic float getCompatibility(java.lang.Class type)
getCompatibility in class Typetype - type to estimate
getValueClass()public int getSQLCode()
getSQLCode in class Typepublic java.lang.Class getValueClass()
getValueClass in class FormatType
public DataValue toData(java.sql.CallableStatement statement,
int column)
throws InvalidDataException,
java.sql.SQLException
Gets statement short value, and returns a corresponding
CountData value.
toData in class Typestatement - statement holding the data value to be convertedcolumn - SQL column index for the data value to be converted
InvalidDataException - if given object value could not be parsed
java.sql.SQLException - if a SQL error occurstoData(Object),
toData(ResultSet,int),
toData(String,ParsePosition),
CountData
public DataValue toData(java.lang.Object objectValue)
throws InvalidDataException
Number objects are converted directly, other objects are converted first to strings, then to count values.
toData in class TypeobjectValue - data object
InvalidDataException - if given object value could not be parsedtoData(CallableStatement,int),
toData(ResultSet,int),
toData(String,ParsePosition),
CountData
public DataValue toData(java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
Count type expects the given value to contain known token strings,
or an integer value, and returns a corresponding
CountData value
toData in class TypestringValue - data stringstatus - parse status (may be null)
InvalidDataException - if given string value could not be parsedtoData(CallableStatement,int),
toData(Object),
toData(ResultSet,int),
CountData
public DataValue toData(java.sql.ResultSet resultSet,
int column)
throws InvalidDataException,
java.sql.SQLException
Gets result set column short value, and returns a corresponding
CountData value.
toData in class TyperesultSet - resultSet holding the data value to be convertedcolumn - SQL column index for the data value to be converted
InvalidDataException - if given object value could not be parsed
java.sql.SQLException - if a SQL error occurstoData(CallableStatement,int),
toData(Object),
toData(String,ParsePosition),
CountDatapublic java.lang.String getSpecs()
getSpecs in class TypesetSpecs(java.lang.String)public void setSpecs(java.lang.String specs)
setSpecs in class Typespecs - counter token string (may be null)
public java.lang.Short countValue(java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
null or empty string
value will evaluate to null boolean value.
stringValue - counter value string (may be null)status - parse status (may be null)
InvalidDataExeption - if value cannot be decoded
InvalidDataExceptionpublic java.lang.String getToken()
getSpecs(),
setSpecs(java.lang.String)public java.lang.String stringValue(short value)
stringValue in interface NumberTypestringValue in class SimpleNumberTypevalue - counter valueFormatType.getFormatter()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||