org.apache.derby.client.am
Class CrossConverters

java.lang.Object
  extended by org.apache.derby.client.am.CrossConverters

final class CrossConverters
extends java.lang.Object


Field Summary
(package private)  Agent agent_
           
private static java.math.BigDecimal bdMaxByteValue__
           
private static java.math.BigDecimal bdMaxDoubleValue__
           
private static java.math.BigDecimal bdMaxFloatValue__
           
private static java.math.BigDecimal bdMaxIntValue__
           
private static java.math.BigDecimal bdMaxLongValue__
           
private static java.math.BigDecimal bdMaxShortValue__
           
private static java.math.BigDecimal bdMinByteValue__
           
private static java.math.BigDecimal bdMinDoubleValue__
           
private static java.math.BigDecimal bdMinFloatValue__
           
private static java.math.BigDecimal bdMinIntValue__
           
private static java.math.BigDecimal bdMinLongValue__
           
private static java.math.BigDecimal bdMinShortValue__
           
private static java.math.BigDecimal bdOne__
           
private static java.math.BigDecimal bdZero__
           
static int UNKNOWN_LENGTH
          Value used to signal unknown length of data.
 
Constructor Summary
CrossConverters(Agent agent)
           
 
Method Summary
(package private)  java.sql.Date date_valueOf(java.lang.String s, java.util.Calendar cal)
          Convert a string to a date in the specified calendar.
private static int digit(char ch)
          Convert a character to a digit.
(package private)  java.math.BigDecimal getBigDecimalFromBoolean(boolean source)
           
(package private)  java.math.BigDecimal getBigDecimalFromString(java.lang.String source)
           
(package private)  boolean getBooleanFromBigDecimal(java.math.BigDecimal source)
           
(package private)  boolean getBooleanFromByte(byte source)
           
(package private)  boolean getBooleanFromDouble(double source)
           
(package private)  boolean getBooleanFromFloat(float source)
           
(package private)  boolean getBooleanFromInt(int source)
           
(package private)  boolean getBooleanFromLong(long source)
           
(package private)  boolean getBooleanFromShort(short source)
           
(package private)  boolean getBooleanFromString(java.lang.String source)
           
(package private)  byte getByteFromBigDecimal(java.math.BigDecimal source)
           
(package private)  byte getByteFromBoolean(boolean source)
           
(package private)  byte getByteFromDouble(double source)
           
(package private)  byte getByteFromFloat(float source)
           
(package private)  byte getByteFromInt(int source)
           
(package private)  byte getByteFromLong(long source)
           
(package private)  byte getByteFromShort(short source)
           
(package private)  byte getByteFromString(java.lang.String source)
           
(package private)  java.sql.Date getDateFromString(java.lang.String source, java.util.Calendar cal)
           
(package private)  java.sql.Date getDateFromTime(java.sql.Time source)
           
(package private)  java.sql.Date getDateFromTimestamp(java.sql.Timestamp source)
           
(package private)  double getDoubleFromBigDecimal(java.math.BigDecimal source)
           
(package private)  double getDoubleFromBoolean(boolean source)
           
(package private)  double getDoubleFromString(java.lang.String source)
           
(package private)  float getFloatFromBigDecimal(java.math.BigDecimal source)
           
(package private)  float getFloatFromBoolean(boolean source)
           
(package private)  float getFloatFromDouble(double source)
           
(package private)  float getFloatFromString(java.lang.String source)
           
static int getInputJdbcType(int jdbcType)
          Convert the input targetJdbcType to the correct JdbcType used by CrossConverters.
(package private)  int getIntFromBigDecimal(java.math.BigDecimal source)
           
(package private)  int getIntFromBoolean(boolean source)
           
(package private)  int getIntFromDouble(double source)
           
(package private)  int getIntFromFloat(float source)
           
(package private)  int getIntFromLong(long source)
           
(package private)  int getIntFromString(java.lang.String source)
           
(package private)  long getLongFromBigDecimal(java.math.BigDecimal source)
           
(package private)  long getLongFromBoolean(boolean source)
           
(package private)  long getLongFromDouble(double source)
           
(package private)  long getLongFromFloat(float source)
           
(package private)  long getLongFromString(java.lang.String source)
           
(package private)  short getShortFromBigDecimal(java.math.BigDecimal source)
           
(package private)  short getShortFromBoolean(boolean source)
           
(package private)  short getShortFromDouble(double source)
           
(package private)  short getShortFromFloat(float source)
           
(package private)  short getShortFromInt(int source)
           
(package private)  short getShortFromLong(long source)
           
(package private)  short getShortFromString(java.lang.String source)
           
(package private)  java.lang.String getStringFromBoolean(boolean source)
           
(package private)  java.lang.String getStringFromBytes(byte[] bytes)
           
(package private)  java.sql.Time getTimeFromString(java.lang.String source, java.util.Calendar cal)
           
(package private)  java.sql.Time getTimeFromTimestamp(java.sql.Timestamp source)
           
(package private)  java.sql.Timestamp getTimestampFromDate(java.sql.Date source)
           
(package private)  java.sql.Timestamp getTimestampFromString(java.lang.String source, java.util.Calendar cal)
           
(package private)  java.sql.Timestamp getTimestampFromTime(java.sql.Time source)
           
private static void initDatePortion(java.util.Calendar cal, java.lang.String date)
          Initialize the date components of a java.util.Calendar from a string on the format YYYY-MM-DD.
private  void initTimePortion(java.util.Calendar cal, java.lang.String time)
          Initialize the time components of a java.util.Calendar from a string on the format HH:MM:SS.
private  byte parseByte(java.lang.String s)
           
private  int parseInt(java.lang.String s)
           
private  long parseLong(java.lang.String s)
           
private  short parseShort(java.lang.String s)
           
(package private)  boolean setBooleanFromObject(java.lang.Object source, int sourceType)
           
(package private)  byte setByteFromObject(java.lang.Object source, int sourceType)
           
private  byte[] setBytesFromStream(java.io.InputStream is, int length)
           
(package private)  java.lang.Object setObject(int targetType, java.math.BigDecimal source)
           
(package private)  java.lang.Object setObject(int targetType, java.sql.Blob source)
           
(package private)  java.lang.Object setObject(int targetType, boolean source)
           
(package private)  java.lang.Object setObject(int targetType, byte source)
           
(package private)  java.lang.Object setObject(int targetType, byte[] source)
           
(package private)  java.lang.Object setObject(int targetType, java.sql.Clob source)
           
(package private)  java.lang.Object setObject(int targetType, java.sql.Date source)
           
(package private)  java.lang.Object setObject(int targetType, double source)
           
(package private)  java.lang.Object setObject(int targetType, float source)
           
(package private)  java.lang.Object setObject(int targetType, int source)
           
(package private)  java.lang.Object setObject(int targetType, long source)
           
(package private)  java.lang.Object setObject(int targetType, java.lang.Object source)
           
(package private)  java.lang.Object setObject(int targetType, java.io.Reader source, int length)
           
(package private)  java.lang.Object setObject(int targetType, short source)
           
(package private)  java.lang.Object setObject(int targetDriverType, java.lang.String source)
           
(package private)  java.lang.Object setObject(int targetType, java.sql.Time source)
           
(package private)  java.lang.Object setObject(int targetType, java.sql.Timestamp source)
           
(package private)  java.lang.Object setObjectFromBinaryStream(int targetType, java.io.InputStream source, int length)
           
(package private)  java.lang.Object setObjectFromCharacterStream(int targetType, java.io.InputStream source, java.lang.String encoding, int length)
           
private  java.lang.String setStringFromReader(java.io.Reader r, int length)
           
private  java.lang.String setStringFromStream(java.io.InputStream is, java.lang.String encoding, int length)
           
private  void skipPadding(java.lang.String s, int i, int length)
           
(package private)  java.sql.Time time_valueOf(java.lang.String s, java.util.Calendar cal)
          Convert a string to a time in the specified calendar.
(package private)  java.sql.Timestamp timestamp_valueOf(java.lang.String s, java.util.Calendar cal)
          Convert a string to a timestamp in the specified calendar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_LENGTH

public static final int UNKNOWN_LENGTH
Value used to signal unknown length of data.

See Also:
Constant Field Values

bdMaxByteValue__

private static final java.math.BigDecimal bdMaxByteValue__

bdMinByteValue__

private static final java.math.BigDecimal bdMinByteValue__

bdMaxShortValue__

private static final java.math.BigDecimal bdMaxShortValue__

bdMinShortValue__

private static final java.math.BigDecimal bdMinShortValue__

bdMaxIntValue__

private static final java.math.BigDecimal bdMaxIntValue__

bdMinIntValue__

private static final java.math.BigDecimal bdMinIntValue__

bdMaxLongValue__

private static final java.math.BigDecimal bdMaxLongValue__

bdMinLongValue__

private static final java.math.BigDecimal bdMinLongValue__

bdMaxFloatValue__

private static final java.math.BigDecimal bdMaxFloatValue__

bdMinFloatValue__

private static final java.math.BigDecimal bdMinFloatValue__

bdMaxDoubleValue__

private static final java.math.BigDecimal bdMaxDoubleValue__

bdMinDoubleValue__

private static final java.math.BigDecimal bdMinDoubleValue__

bdZero__

private static final java.math.BigDecimal bdZero__

bdOne__

private static final java.math.BigDecimal bdOne__

agent_

Agent agent_
Constructor Detail

CrossConverters

CrossConverters(Agent agent)
Method Detail

setObject

final java.lang.Object setObject(int targetType,
                                 boolean source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 byte source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 short source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 int source)
                          throws SqlException
Throws:
SqlException

setBooleanFromObject

final boolean setBooleanFromObject(java.lang.Object source,
                                   int sourceType)
                            throws SqlException
Throws:
SqlException

setByteFromObject

final byte setByteFromObject(java.lang.Object source,
                             int sourceType)
                      throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 long source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 float source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 double source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.math.BigDecimal source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.sql.Date source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.sql.Time source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.sql.Timestamp source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetDriverType,
                                 java.lang.String source)
                          throws SqlException
Throws:
SqlException

getInputJdbcType

public static int getInputJdbcType(int jdbcType)
Convert the input targetJdbcType to the correct JdbcType used by CrossConverters.


setObject

final java.lang.Object setObject(int targetType,
                                 byte[] source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.io.Reader source,
                                 int length)
                          throws SqlException
Throws:
SqlException

setStringFromReader

private final java.lang.String setStringFromReader(java.io.Reader r,
                                                   int length)
                                            throws SqlException
Throws:
SqlException

setObjectFromCharacterStream

final java.lang.Object setObjectFromCharacterStream(int targetType,
                                                    java.io.InputStream source,
                                                    java.lang.String encoding,
                                                    int length)
                                             throws SqlException
Throws:
SqlException

setStringFromStream

private final java.lang.String setStringFromStream(java.io.InputStream is,
                                                   java.lang.String encoding,
                                                   int length)
                                            throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.sql.Blob source)
                          throws SqlException
Throws:
SqlException

setObjectFromBinaryStream

final java.lang.Object setObjectFromBinaryStream(int targetType,
                                                 java.io.InputStream source,
                                                 int length)
                                          throws SqlException
Throws:
SqlException

setBytesFromStream

private final byte[] setBytesFromStream(java.io.InputStream is,
                                        int length)
                                 throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.sql.Clob source)
                          throws SqlException
Throws:
SqlException

setObject

final java.lang.Object setObject(int targetType,
                                 java.lang.Object source)
                          throws SqlException
Throws:
SqlException

getBooleanFromByte

final boolean getBooleanFromByte(byte source)
                          throws SqlException
Throws:
SqlException

getBooleanFromShort

final boolean getBooleanFromShort(short source)
                           throws SqlException
Throws:
SqlException

getBooleanFromInt

final boolean getBooleanFromInt(int source)
                         throws SqlException
Throws:
SqlException

getBooleanFromLong

final boolean getBooleanFromLong(long source)
                          throws SqlException
Throws:
SqlException

getBooleanFromFloat

final boolean getBooleanFromFloat(float source)
                           throws SqlException
Throws:
SqlException

getBooleanFromDouble

final boolean getBooleanFromDouble(double source)
                            throws SqlException
Throws:
SqlException

getBooleanFromBigDecimal

final boolean getBooleanFromBigDecimal(java.math.BigDecimal source)
                                throws SqlException
Throws:
SqlException

getBooleanFromString

final boolean getBooleanFromString(java.lang.String source)
                            throws SqlException
Throws:
SqlException

getByteFromShort

final byte getByteFromShort(short source)
                     throws SqlException
Throws:
SqlException

getByteFromInt

final byte getByteFromInt(int source)
                   throws SqlException
Throws:
SqlException

getByteFromLong

final byte getByteFromLong(long source)
                    throws SqlException
Throws:
SqlException

getByteFromFloat

final byte getByteFromFloat(float source)
                     throws SqlException
Throws:
SqlException

getByteFromDouble

final byte getByteFromDouble(double source)
                      throws SqlException
Throws:
SqlException

getByteFromBigDecimal

final byte getByteFromBigDecimal(java.math.BigDecimal source)
                          throws SqlException
Throws:
SqlException

getByteFromBoolean

final byte getByteFromBoolean(boolean source)
                       throws SqlException
Throws:
SqlException

getByteFromString

final byte getByteFromString(java.lang.String source)
                      throws SqlException
Throws:
SqlException

getShortFromInt

final short getShortFromInt(int source)
                     throws SqlException
Throws:
SqlException

getShortFromLong

final short getShortFromLong(long source)
                      throws SqlException
Throws:
SqlException

getShortFromFloat

final short getShortFromFloat(float source)
                       throws SqlException
Throws:
SqlException

getShortFromDouble

final short getShortFromDouble(double source)
                        throws SqlException
Throws:
SqlException

getShortFromBigDecimal

final short getShortFromBigDecimal(java.math.BigDecimal source)
                            throws SqlException
Throws:
SqlException

getShortFromBoolean

final short getShortFromBoolean(boolean source)
                         throws SqlException
Throws:
SqlException

getShortFromString

final short getShortFromString(java.lang.String source)
                        throws SqlException
Throws:
SqlException

getIntFromLong

final int getIntFromLong(long source)
                  throws SqlException
Throws:
SqlException

getIntFromFloat

final int getIntFromFloat(float source)
                   throws SqlException
Throws:
SqlException

getIntFromDouble

final int getIntFromDouble(double source)
                    throws SqlException
Throws:
SqlException

getIntFromBigDecimal

final int getIntFromBigDecimal(java.math.BigDecimal source)
                        throws SqlException
Throws:
SqlException

getIntFromBoolean

final int getIntFromBoolean(boolean source)
                     throws SqlException
Throws:
SqlException

getIntFromString

final int getIntFromString(java.lang.String source)
                    throws SqlException
Throws:
SqlException

getLongFromFloat

final long getLongFromFloat(float source)
                     throws SqlException
Throws:
SqlException

getLongFromDouble

final long getLongFromDouble(double source)
                      throws SqlException
Throws:
SqlException

getLongFromBigDecimal

final long getLongFromBigDecimal(java.math.BigDecimal source)
                          throws SqlException
Throws:
SqlException

getLongFromBoolean

final long getLongFromBoolean(boolean source)
                       throws SqlException
Throws:
SqlException

getLongFromString

final long getLongFromString(java.lang.String source)
                      throws SqlException
Throws:
SqlException

getFloatFromDouble

final float getFloatFromDouble(double source)
                        throws SqlException
Throws:
SqlException

getFloatFromBigDecimal

final float getFloatFromBigDecimal(java.math.BigDecimal source)
                            throws SqlException
Throws:
SqlException

getFloatFromBoolean

final float getFloatFromBoolean(boolean source)
                         throws SqlException
Throws:
SqlException

getFloatFromString

final float getFloatFromString(java.lang.String source)
                        throws SqlException
Throws:
SqlException

getDoubleFromBigDecimal

final double getDoubleFromBigDecimal(java.math.BigDecimal source)
                              throws SqlException
Throws:
SqlException

getDoubleFromBoolean

final double getDoubleFromBoolean(boolean source)
                           throws SqlException
Throws:
SqlException

getDoubleFromString

final double getDoubleFromString(java.lang.String source)
                          throws SqlException
Throws:
SqlException

getBigDecimalFromBoolean

final java.math.BigDecimal getBigDecimalFromBoolean(boolean source)
                                             throws SqlException
Throws:
SqlException

getBigDecimalFromString

final java.math.BigDecimal getBigDecimalFromString(java.lang.String source)
                                            throws SqlException
Throws:
SqlException

getStringFromBoolean

final java.lang.String getStringFromBoolean(boolean source)
                                     throws SqlException
Throws:
SqlException

getStringFromBytes

final java.lang.String getStringFromBytes(byte[] bytes)
                                   throws SqlException
Throws:
SqlException

getDateFromString

final java.sql.Date getDateFromString(java.lang.String source,
                                      java.util.Calendar cal)
                               throws SqlException
Throws:
SqlException

getDateFromTime

final java.sql.Date getDateFromTime(java.sql.Time source)
                             throws SqlException
Throws:
SqlException

getDateFromTimestamp

final java.sql.Date getDateFromTimestamp(java.sql.Timestamp source)
                                  throws SqlException
Throws:
SqlException

getTimeFromString

final java.sql.Time getTimeFromString(java.lang.String source,
                                      java.util.Calendar cal)
                               throws SqlException
Throws:
SqlException

getTimeFromTimestamp

final java.sql.Time getTimeFromTimestamp(java.sql.Timestamp source)
                                  throws SqlException
Throws:
SqlException

getTimestampFromString

final java.sql.Timestamp getTimestampFromString(java.lang.String source,
                                                java.util.Calendar cal)
                                         throws SqlException
Throws:
SqlException

getTimestampFromTime

final java.sql.Timestamp getTimestampFromTime(java.sql.Time source)
                                       throws SqlException
Throws:
SqlException

getTimestampFromDate

final java.sql.Timestamp getTimestampFromDate(java.sql.Date source)
                                       throws SqlException
Throws:
SqlException

date_valueOf

final java.sql.Date date_valueOf(java.lang.String s,
                                 java.util.Calendar cal)
Convert a string to a date in the specified calendar. Accept the same format as java.sql.Date.valueOf().

Parameters:
s - the string to parse
cal - the calendar (or null to use the default calendar)
Returns:
a java.sql.Date value that represents the date in the calendar cal
Throws:
java.lang.IllegalArgumentException - if the format of the string is invalid

initDatePortion

private static void initDatePortion(java.util.Calendar cal,
                                    java.lang.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 - the calendar whose date components to initialize
date - a string representing a date
Throws:
java.lang.IllegalArgumentException - if the date string is not on the format YYYY-MM-DD

digit

private static int digit(char ch)
Convert a character to a digit.

Parameters:
ch - the character
Returns:
the corresponding digit (0-9)
Throws:
java.lang.IllegalArgumentException - if ch doesn't represent a digit

time_valueOf

final java.sql.Time time_valueOf(java.lang.String s,
                                 java.util.Calendar cal)
Convert a string to a time in the specified calendar. Accept the same format as java.sql.Time.valueOf().

Parameters:
s - the string to parse
cal - the calendar (or null to use the default calendar)
Returns:
a java.sql.Time value that represents the time in the calendar cal
Throws:
java.lang.IllegalArgumentException - if the format of the string is invalid

initTimePortion

private void initTimePortion(java.util.Calendar cal,
                             java.lang.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 - the calendar whose time components to initialize
time - a string representing a time
Throws:
java.lang.IllegalArgumentException - if the time string is not on the format HH:MM:SS

timestamp_valueOf

final java.sql.Timestamp timestamp_valueOf(java.lang.String s,
                                           java.util.Calendar cal)
Convert a string to a timestamp in the specified calendar. Accept the same format as java.sql.Timestamp.valueOf().

Parameters:
s - the string to parse
cal - the calendar (or null to use the default calendar)
Returns:
a java.sql.Timestamp value that represents the timestamp in the calendar cal
Throws:
java.lang.IllegalArgumentException - if the format of the string is invalid

parseByte

private final byte parseByte(java.lang.String s)
                      throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

parseShort

private final short parseShort(java.lang.String s)
                        throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

parseInt

private final int parseInt(java.lang.String s)
                    throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

parseLong

private final long parseLong(java.lang.String s)
                      throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

skipPadding

private final void skipPadding(java.lang.String s,
                               int i,
                               int length)
                        throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.