Top Fields Constructors Methods
org.apache.derby.client.am

pack-priv final Class CrossConverters

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, .InputStream, .Reader, .StringWriter, java.math.BigDecimal, .BigInteger, java.nio.charset.Charset, java.sql.Array, .Blob, .Clob, .Date, .Ref, .Time, .Timestamp, .Types, java.util.Calendar, .Locale, org.apache.derby.shared.common.reference.SQLState

Field Summary

Modifier and TypeField and Description
private final Agent
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final BigDecimal
public static final int
UNKNOWN_LENGTH

Value used to signal unknown length of data.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static Date

Returns:

a Date value that represents the date in the calendar cal
date_valueOf
(String
the string to parse
s
,
Calendar
the calendar (or null to use the default calendar)
cal
)

Convert a string to a date in the specified calendar.

private static int

Returns:

the corresponding digit (0-9)
digit
(char
the character
ch
)

Convert a character to a digit.

pack-priv final BigDecimal
pack-priv final boolean
getBooleanFromDouble(double source)

pack-priv final boolean
getBooleanFromFloat(float source)

pack-priv final boolean
getBooleanFromInt(int source)

pack-priv final boolean
getBooleanFromLong(long source)

pack-priv final boolean
getBooleanFromShort(short source)

pack-priv final boolean

Returns:

false if source is "0" or "false", true otherwise
getBooleanFromString
(String
the value of a CHAR column
source
)

Get a boolean value from a CHAR column.

pack-priv final byte
getByteFromBoolean(boolean source)

pack-priv final byte
getByteFromDouble(double source)

pack-priv final byte
getByteFromFloat(float source)

pack-priv final byte
getByteFromInt(int source)

pack-priv final byte
getByteFromLong(long source)

pack-priv final byte
getByteFromShort(short source)

pack-priv final byte
pack-priv final Date
pack-priv final double
getDoubleFromBoolean(boolean source)

pack-priv final double
pack-priv final float
getFloatFromBoolean(boolean source)

pack-priv final float
getFloatFromDouble(double source)

pack-priv final float
public static int
getInputJdbcType(int jdbcType)

Convert the input targetJdbcType to the correct JdbcType used by CrossConverters.

pack-priv final int
getIntFromBoolean(boolean source)

pack-priv final int
getIntFromDouble(double source)

pack-priv final int
getIntFromFloat(float source)

pack-priv final int
getIntFromLong(long source)

pack-priv final int
pack-priv final long
getLongFromBoolean(boolean source)

pack-priv final long
getLongFromDouble(double source)

pack-priv final long
getLongFromFloat(float source)

pack-priv final long
pack-priv final short
getShortFromBoolean(boolean source)

pack-priv final short
getShortFromDouble(double source)

pack-priv final short
getShortFromFloat(float source)

pack-priv final short
getShortFromInt(int source)

pack-priv final short
getShortFromLong(long source)

pack-priv final short
pack-priv final String
getStringFromBytes(byte[] bytes)

pack-priv final Time
pack-priv final Timestamp
private static void
initDatePortion(Calendar
the calendar whose date components to initialize
cal
,
String
a string representing a date
date
)

Initialize the date components of a java.util.Calendar from a string on the format YYYY-MM-DD.

private static void
initTimePortion(Calendar
the calendar whose time components to initialize
cal
,
String
a string representing a time
time
)

Initialize the time components of a java.util.Calendar from a string on the format HH:MM:SS.

private static byte
private static int
private static long
private static short
pack-priv final boolean
setBooleanFromObject(Object source, int sourceType)

pack-priv final byte
setByteFromObject(Object source, int sourceType)

private byte[]
pack-priv final Object
setObject(int targetType, boolean source)

pack-priv final Object
setObject(int targetType, byte source)

pack-priv final Object
setObject(int targetType, short source)

pack-priv final Object
setObject(int targetType, int source)

pack-priv final Object
setObject(int targetType, long source)

pack-priv final Object
setObject(int targetType, float source)

pack-priv final Object
setObject(int targetType, double source)

pack-priv final Object
setObject(int targetType, BigDecimal source)

pack-priv final Object
setObject(int targetType, Date source)

pack-priv final Object
setObject(int targetType, Time source)

pack-priv final Object
setObject(int targetType, Timestamp source)

pack-priv final Object
setObject(int targetDriverType, String source)

pack-priv final Object
setObject(int targetType, byte[] source)

pack-priv final Object
setObject(int targetType, Reader source, int length)

pack-priv final Object
setObject(int targetType, Blob source)

pack-priv final Object
setObject(int targetType, Clob source)

pack-priv final Object
setObject(int targetType, Object source)

pack-priv final Object
setObjectFromBinaryStream(int targetType, InputStream source, int length)

pack-priv final Object
setObjectFromCharacterStream(int targetType, InputStream source, Charset encoding, int length)

private String
setStringFromReader(Reader r, int length)

private String
setStringFromStream(InputStream is, Charset encoding, int length)

private static void
skipPadding(String s, int i, int length)

private static Time

Returns:

a java.sql.Time value that represents the time in the calendar cal
time_valueOf
(String
the string to parse
s
,
Calendar
the calendar (or null to use the default calendar)
cal
)

Convert a string to a time in the specified calendar.

private static Timestamp

Returns:

a java.sql.Timestamp value that represents the timestamp in the calendar cal
timestamp_valueOf
(String
the string to parse
s
,
Calendar
the calendar (or null to use the default calendar)
cal
)

Convert a string to a timestamp in the specified calendar.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

agent_back to summary
private final Agent agent_
bdMaxByteValue__back to summary
private static final BigDecimal bdMaxByteValue__
bdMaxDoubleValue__back to summary
private static final BigDecimal bdMaxDoubleValue__
bdMaxFloatValue__back to summary
private static final BigDecimal bdMaxFloatValue__
bdMaxIntValue__back to summary
private static final BigDecimal bdMaxIntValue__
bdMaxLongValue__back to summary
private static final BigDecimal bdMaxLongValue__
bdMaxShortValue__back to summary
private static final BigDecimal bdMaxShortValue__
bdMinByteValue__back to summary
private static final BigDecimal bdMinByteValue__
bdMinDoubleValue__back to summary
private static final BigDecimal bdMinDoubleValue__
bdMinFloatValue__back to summary
private static final BigDecimal bdMinFloatValue__
bdMinIntValue__back to summary
private static final BigDecimal bdMinIntValue__
bdMinLongValue__back to summary
private static final BigDecimal bdMinLongValue__
bdMinShortValue__back to summary
private static final BigDecimal bdMinShortValue__
bdOne__back to summary
private static final BigDecimal bdOne__
bdZero__back to summary
private static final BigDecimal bdZero__
UNKNOWN_LENGTHback to summary
public static final int UNKNOWN_LENGTH

Value used to signal unknown length of data.

Constructor Detail

CrossConvertersback to summary
pack-priv CrossConverters(Agent agent)

Method Detail

date_valueOfback to summary
private static Date date_valueOf(String s, Calendar cal)

Convert a string to a date in the specified calendar. Accept the same format as Date.valueOf().

Parameters
s:String

the string to parse

cal:Calendar

the calendar (or null to use the default calendar)

Returns:Date

a Date value that represents the date in the calendar cal

Exceptions
IllegalArgumentException:
if the format of the string is invalid
digitback to summary
private static int digit(char ch)

Convert a character to a digit.

Parameters
ch:char

the character

Returns:int

the corresponding digit (0-9)

Exceptions
IllegalArgumentException:
if ch doesn't represent a digit
getBigDecimalFromStringback to summary
pack-priv final BigDecimal getBigDecimalFromString(String source) throws SqlException
getBooleanFromDoubleback to summary
pack-priv final boolean getBooleanFromDouble(double source) throws SqlException
getBooleanFromFloatback to summary
pack-priv final boolean getBooleanFromFloat(float source) throws SqlException
getBooleanFromIntback to summary
pack-priv final boolean getBooleanFromInt(int source) throws SqlException
getBooleanFromLongback to summary
pack-priv final boolean getBooleanFromLong(long source) throws SqlException
getBooleanFromShortback to summary
pack-priv final boolean getBooleanFromShort(short source) throws SqlException
getBooleanFromStringback to summary
pack-priv final boolean getBooleanFromString(String source)

Get a boolean value from a CHAR column. In order to match the embedded driver and JCC we return false iff the CHAR value is "0" or "false".

Leading and trailing whitespace is removed from the input string before it's compared to "0" and "false". No other normalization is performed. Specifically, no case conversion is performed, so the comparison is case sensitive, and everything that doesn't exactly match "0" or "false" will be considered true.

Parameters
source:String

the value of a CHAR column

Returns:boolean

false if source is "0" or "false", true otherwise

getByteFromBooleanback to summary
pack-priv final byte getByteFromBoolean(boolean source) throws SqlException
getByteFromDoubleback to summary
pack-priv final byte getByteFromDouble(double source) throws SqlException
getByteFromFloatback to summary
pack-priv final byte getByteFromFloat(float source) throws SqlException
getByteFromIntback to summary
pack-priv final byte getByteFromInt(int source) throws SqlException
getByteFromLongback to summary
pack-priv final byte getByteFromLong(long source) throws SqlException
getByteFromShortback to summary
pack-priv final byte getByteFromShort(short source) throws SqlException
getByteFromStringback to summary
pack-priv final byte getByteFromString(String source) throws SqlException
getDateFromStringback to summary
pack-priv final Date getDateFromString(String source, Calendar cal) throws SqlException
getDoubleFromBooleanback to summary
pack-priv final double getDoubleFromBoolean(boolean source) throws SqlException
getDoubleFromStringback to summary
pack-priv final double getDoubleFromString(String source) throws SqlException
getFloatFromBooleanback to summary
pack-priv final float getFloatFromBoolean(boolean source) throws SqlException
getFloatFromDoubleback to summary
pack-priv final float getFloatFromDouble(double source) throws SqlException
getFloatFromStringback to summary
pack-priv final float getFloatFromString(String source) throws SqlException
getInputJdbcTypeback to summary
public static int getInputJdbcType(int jdbcType)

Convert the input targetJdbcType to the correct JdbcType used by CrossConverters.

getIntFromBooleanback to summary
pack-priv final int getIntFromBoolean(boolean source) throws SqlException
getIntFromDoubleback to summary
pack-priv final int getIntFromDouble(double source) throws SqlException
getIntFromFloatback to summary
pack-priv final int getIntFromFloat(float source) throws SqlException
getIntFromLongback to summary
pack-priv final int getIntFromLong(long source) throws SqlException
getIntFromStringback to summary
pack-priv final int getIntFromString(String source) throws SqlException
getLongFromBooleanback to summary
pack-priv final long getLongFromBoolean(boolean source) throws SqlException
getLongFromDoubleback to summary
pack-priv final long getLongFromDouble(double source) throws SqlException
getLongFromFloatback to summary
pack-priv final long getLongFromFloat(float source) throws SqlException
getLongFromStringback to summary
pack-priv final long getLongFromString(String source) throws SqlException
getShortFromBooleanback to summary
pack-priv final short getShortFromBoolean(boolean source) throws SqlException
getShortFromDoubleback to summary
pack-priv final short getShortFromDouble(double source) throws SqlException
getShortFromFloatback to summary
pack-priv final short getShortFromFloat(float source) throws SqlException
getShortFromIntback to summary
pack-priv final short getShortFromInt(int source) throws SqlException
getShortFromLongback to summary
pack-priv final short getShortFromLong(long source) throws SqlException
getShortFromStringback to summary
pack-priv final short getShortFromString(String source) throws SqlException
getStringFromBytesback to summary
pack-priv final String getStringFromBytes(byte[] bytes) throws SqlException
getTimeFromStringback to summary
pack-priv final Time getTimeFromString(String source, Calendar cal) throws SqlException
getTimestampFromStringback to summary
pack-priv final Timestamp getTimestampFromString(String source, Calendar cal) throws SqlException
initDatePortionback to summary
private static void initDatePortion(Calendar cal, String date)

Initialize the date components of a java.util.Calendar from a string on the format YYYY-MM-DD. All other components are left untouched.

Parameters
cal:Calendar

the calendar whose date components to initialize

date:String

a string representing a date

Exceptions
IllegalArgumentException:
if the date string is not on the format YYYY-MM-DD
initTimePortionback to summary
private static void initTimePortion(Calendar cal, String time)

Initialize the time components of a java.util.Calendar from a string on the format HH:MM:SS. All other components are left untouched.

Parameters
cal:Calendar

the calendar whose time components to initialize

time:String

a string representing a time

Exceptions
IllegalArgumentException:
if the time string is not on the format HH:MM:SS
parseByteback to summary
private static byte parseByte(String s) throws NumberFormatException
parseIntback to summary
private static int parseInt(String s) throws NumberFormatException
parseLongback to summary
private static long parseLong(String s) throws NumberFormatException
parseShortback to summary
private static short parseShort(String s) throws NumberFormatException
setBooleanFromObjectback to summary
pack-priv final boolean setBooleanFromObject(Object source, int sourceType) throws SqlException
setByteFromObjectback to summary
pack-priv final byte setByteFromObject(Object source, int sourceType) throws SqlException
setBytesFromStreamback to summary
private byte[] setBytesFromStream(InputStream is, int length) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, boolean source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, byte source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, short source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, int source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, long source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, float source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, double source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, BigDecimal source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, Date source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, Time source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, Timestamp source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetDriverType, String source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, byte[] source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, Reader source, int length) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, Blob source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, Clob source) throws SqlException
setObjectback to summary
pack-priv final Object setObject(int targetType, Object source) throws SqlException
setObjectFromBinaryStreamback to summary
pack-priv final Object setObjectFromBinaryStream(int targetType, InputStream source, int length) throws SqlException
setObjectFromCharacterStreamback to summary
pack-priv final Object setObjectFromCharacterStream(int targetType, InputStream source, Charset encoding, int length) throws SqlException
setStringFromReaderback to summary
private String setStringFromReader(Reader r, int length) throws SqlException
setStringFromStreamback to summary
private String setStringFromStream(InputStream is, Charset encoding, int length) throws SqlException
skipPaddingback to summary
private static void skipPadding(String s, int i, int length) throws NumberFormatException
time_valueOfback to summary
private static Time time_valueOf(String s, Calendar cal)

Convert a string to a time in the specified calendar. Accept the same format as java.sql.Time.valueOf().

Parameters
s:String

the string to parse

cal:Calendar

the calendar (or null to use the default calendar)

Returns:Time

a java.sql.Time value that represents the time in the calendar cal

Exceptions
IllegalArgumentException:
if the format of the string is invalid
timestamp_valueOfback to summary
private static Timestamp timestamp_valueOf(String s, Calendar cal)

Convert a string to a timestamp in the specified calendar. Accept the same format as java.sql.Timestamp.valueOf().

Parameters
s:String

the string to parse

cal:Calendar

the calendar (or null to use the default calendar)

Returns:Timestamp

a java.sql.Timestamp value that represents the timestamp in the calendar cal

Exceptions
IllegalArgumentException:
if the format of the string is invalid