|
|||||||||||
| 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.BooleanType
BooleanType defines a data type that interpretes the strings
true and false as corresponding boolean
values. A set of custom true and false
strings can also be specified.
true and false values, expressed in a
format string as:
trueKeyword [ " " falseKeyword ]Once set, terms that match the given keywords are interpreted as and printed for boolean
true and false
values. The default keywords "true" and "false" are also always
recognized, but printed only if corresponding custom keywords have
not been defined.
BooleanData,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class java.text.Format |
java.text.Format.Field |
| Field Summary | |
static BooleanType |
DEFAULT
Default boolean type. |
static java.lang.String |
FALSE
Default false string ("false"). |
static int |
FALSELENGTH
Default false string length. |
static java.lang.String |
TRUE
Default true string ("true"). |
static int |
TRUELENGTH
Default true string length. |
static java.lang.String |
TYPENAME
Type name ("BOOLEAN"). |
| Fields inherited from class com.davisor.data.Type |
METADATA_GROUP, METADATA_NAME, METADATA_PARENT, METADATA_SUBCHANNELS |
| Constructor Summary | |
|
BooleanType()
Default constructor. |
|
BooleanType(BooleanType bt)
Copy constructor. |
|
BooleanType(java.lang.String dataName)
Creates a new default type with no identity. |
|
BooleanType(java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.lang.String trueString,
java.lang.String falseString)
Creates a new boolean type. |
|
BooleanType(java.lang.String dataName,
java.lang.String id,
java.lang.String format)
Constructs a new type with given spesification. |
protected |
BooleanType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.lang.String trueString,
java.lang.String falseString)
Creates a new boolean type. |
| Method Summary | |
java.lang.Boolean |
decode(java.lang.String value)
Converts a string to a Boolean value. |
java.lang.Boolean |
decode(java.lang.String stringValue,
java.text.ParsePosition status)
Converts a string to a boolean value. |
com.davisor.core.Dupable |
dup()
Makes a deep copy of this object. |
java.lang.String |
encode(java.lang.Boolean value)
Convert Boolean to string value. |
boolean |
equals(java.lang.Object o)
Tests if this object is equal with another object. |
java.lang.String |
getFormat()
Gets the current boolean format. |
int |
getSQLCode()
Gets the SQL type code, as defined by java.sql.Types. |
java.lang.Class |
getValueClass()
Gets value container class. |
int |
hashCode()
Returns a hash code value for the object. |
void |
setFormat(java.lang.String format)
Sets the boolean format. |
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. |
DataValue |
zero()
Gets zero data value for this type. |
| Methods inherited from class com.davisor.data.Type |
ceil, check, check, compare, create, create, create, create, create, dup, floor, format, getCompatibility, 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 BooleanType DEFAULT
public static final java.lang.String TYPENAME
public static final java.lang.String TRUE
public static final int TRUELENGTH
public static final java.lang.String FALSE
public static final int FALSELENGTH
| Constructor Detail |
public BooleanType()
public BooleanType(BooleanType bt)
public BooleanType(java.lang.String dataName)
dataName - data name (may be null)
public BooleanType(java.lang.String dataName,
java.lang.String id,
java.lang.String format)
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)format - type spesification (may be null)setFormat(java.lang.String)
public BooleanType(java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.lang.String trueString,
java.lang.String falseString)
dataName - data name (may be null)id - type identity (may be null)metaData - type meta data map (may be null)trueString - true value keywordfalseString - false value keyword
protected BooleanType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.lang.String trueString,
java.lang.String falseString)
typeName - type namedataName - data name (may be null)id - type identity (may be null)metaData - type meta data map (may be null)trueString - true value keywordfalseString - false value keyword| Method Detail |
public com.davisor.core.Dupable dup()
dup in interface com.davisor.core.Dupabledup in class Typepublic boolean equals(java.lang.Object o)
Boolean types are equal if their super-classes and custom truth values are.
equals in interface java.util.Comparatorequals in class TypeCompare.equals(Object,Object)public int hashCode()
hashCode in class Type
public java.lang.Boolean decode(java.lang.String value)
throws InvalidDataException
value - the string from which the truth value is searched for
InvalidDataExeption - if value cannot be decoded
InvalidDataExceptiondecode(String,ParsePosition)
public java.lang.Boolean decode(java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
true string, then the boolean value will
evaluate true. Likewise, if the first characters in
value are equal to either the default or current
custom false string, the boolean value will evaluate
false. null or empty string value will
evaluate to null boolean value.
stringValue - the string value to convert (may be null)status - parse status (may be null)
InvalidDataExeption - if value cannot be decoded
InvalidDataExceptiondecode(String,ParsePosition)public java.lang.String encode(java.lang.Boolean value)
public int getSQLCode()
getSQLCode in class Typepublic java.lang.Class getValueClass()
getValueClass in class Type
public DataValue toData(java.sql.CallableStatement statement,
int column)
throws InvalidDataException,
java.sql.SQLException
Gets statement boolean value, and returns a corresponding
BooleanData 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),
BooleanData
public DataValue toData(java.lang.Object objectValue)
throws InvalidDataException
Boolean and Number objects are converted directly, other objects are converted first to strings, then to boolean values.
toData in class TypeobjectValue - data object (may be null)
InvalidDataException - if given object value could not be parsedtoData(CallableStatement,int),
toData(ResultSet,int),
toData(String,ParsePosition),
BooleanData
public DataValue toData(java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
Boolean type expects the given value to be one of known boolean
truth value keywords, and returns a corresponding
BooleanData 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),
BooleanData
public DataValue toData(java.sql.ResultSet resultSet,
int column)
throws InvalidDataException,
java.sql.SQLException
Gets result set column boolean value, and returns a corresponding
BooleanData 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),
BooleanDatapublic java.lang.String getFormat()
getFormat in class TypesetFormat(java.lang.String)public void setFormat(java.lang.String format)
setFormat in class Typeformat - boolean format (may be null)Type.getFormat(),
DataValue.getFormat()public DataValue zero()
zero in class TypeBooleanData object sharing this typeDataValue.deinterpolate(com.davisor.data.DataValue, com.davisor.data.DataValue),
DataValue.interpolate(double, com.davisor.data.DataValue)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||