uk.org.ogsadai.converters.csv.resultset.types
Class TypeStrategy

java.lang.Object
  extended byuk.org.ogsadai.converters.csv.resultset.types.TypeStrategy
Direct Known Subclasses:
StringToAllStrategy

public abstract class TypeStrategy
extends java.lang.Object

Abstract strategy super-class for classes that can convert string data into standard Java and java.sql types.

Author:
The OGSA-DAI Team.

Constructor Summary
TypeStrategy()
           
 
Method Summary
 java.sql.Array getArray(java.lang.String value)
          Converts the input string into an array of objects.
 java.io.InputStream getAsciiStream(java.lang.String value)
          Returns an input stream that reads characters from the input string.
 java.math.BigDecimal getBigDecimal(java.lang.String value)
          Returns the BigDecimal value of the input string.
 java.math.BigDecimal getBigDecimal(java.lang.String value, int arg1)
          Returns the BigDecimal value of the input string.
 java.io.InputStream getBinaryStream(java.lang.String value)
          Returns an input stream that reads the input string as binary data.
 java.sql.Blob getBlob(java.lang.String value)
          Returns the input string as a Blob.
 boolean getBoolean(java.lang.String value)
          Returns the boolean value of the input string.
 byte getByte(java.lang.String value)
          Returns the byte value of the input string.
 byte[] getBytes(java.lang.String value)
          Returns the input string as a byte array.
 byte[] getBytes64(java.lang.String value)
          Returns the decoded byte array of the Base64 encoded input string.
 java.io.Reader getCharacterStream(java.lang.String value)
          Returns a Reader that reads from the input string.
 java.sql.Clob getClob(java.lang.String value)
          Returns the input string as a Clob.
 java.sql.Date getDate(java.lang.String value)
          Returns the input string as a Date object.
 java.sql.Date getDate(java.lang.String value, java.util.Calendar calendar)
          Returns the input string as a Date object, using a specific Calendar.
 double getDouble(java.lang.String value)
          Returns the double value of the input string.
 float getFloat(java.lang.String value)
          Returns the float value of the input string.
 int getInt(java.lang.String value)
          Returns the integer value of the input string.
 long getLong(java.lang.String value)
          Returns the long value of the input string.
 java.lang.Object getObject(java.lang.String value)
          Returns the input string as an object.
 java.sql.Ref getRef(java.lang.String value)
          Returns the input string as a Ref.
 short getShort(java.lang.String value)
          Returns the short value of the input string.
 java.lang.String getString(java.lang.String value)
          Returns the input string.
 java.sql.Time getTime(java.lang.String value)
          Returns the input string as a Time object.
 java.sql.Time getTime(java.lang.String value, java.util.Calendar calendar)
          Returns the input string as a Time object.
 java.sql.Timestamp getTimestamp(java.lang.String value)
          Returns the input string as a Timestamp object.
 java.sql.Timestamp getTimestamp(java.lang.String value, java.util.Calendar calendar)
          Returns the input string as a Timestamp object.
 java.io.InputStream getUnicodeStream(java.lang.String value)
          Returns an input stream that reads the input string as unicode data.
 java.net.URL getURL(java.lang.String value)
          Returns the URL value of the input string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeStrategy

public TypeStrategy()
Method Detail

getByte

public byte getByte(java.lang.String value)
             throws java.sql.SQLException
Returns the byte value of the input string.

Parameters:
value - Input data.
Returns:
byte value of the input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getDouble

public double getDouble(java.lang.String value)
                 throws java.sql.SQLException
Returns the double value of the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getFloat

public float getFloat(java.lang.String value)
               throws java.sql.SQLException
Returns the float value of the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getInt

public int getInt(java.lang.String value)
           throws java.sql.SQLException
Returns the integer value of the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getLong

public long getLong(java.lang.String value)
             throws java.sql.SQLException
Returns the long value of the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getShort

public short getShort(java.lang.String value)
               throws java.sql.SQLException
Returns the short value of the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getBoolean

public boolean getBoolean(java.lang.String value)
                   throws java.sql.SQLException
Returns the boolean value of the input string. This is true if the input is equal to "true" or "1" and false otherwise.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getBytes

public byte[] getBytes(java.lang.String value)
                throws java.sql.SQLException
Returns the input string as a byte array.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getBytes64

public byte[] getBytes64(java.lang.String value)
                  throws java.sql.SQLException
Returns the decoded byte array of the Base64 encoded input string.

Parameters:
value - Base64 encoded input data.
Returns:
decoded byte array of the input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getAsciiStream

public java.io.InputStream getAsciiStream(java.lang.String value)
                                   throws java.sql.SQLException
Returns an input stream that reads characters from the input string.

Parameters:
value - Input data.
Returns:
an input stream.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getBinaryStream

public java.io.InputStream getBinaryStream(java.lang.String value)
                                    throws java.sql.SQLException
Returns an input stream that reads the input string as binary data.

Parameters:
value - Input data.
Returns:
an input stream.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getUnicodeStream

public java.io.InputStream getUnicodeStream(java.lang.String value)
                                     throws java.sql.SQLException
Returns an input stream that reads the input string as unicode data.

Parameters:
value - Input data.
Returns:
an input stream.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getCharacterStream

public java.io.Reader getCharacterStream(java.lang.String value)
                                  throws java.sql.SQLException
Returns a Reader that reads from the input string.

Parameters:
value - Input data.
Returns:
a Reader accessing the input value.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getObject

public java.lang.Object getObject(java.lang.String value)
                           throws java.sql.SQLException
Returns the input string as an object.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getString

public java.lang.String getString(java.lang.String value)
                           throws java.sql.SQLException
Returns the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String value)
                                   throws java.sql.SQLException
Returns the BigDecimal value of the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String value,
                                          int arg1)
                                   throws java.sql.SQLException
Returns the BigDecimal value of the input string.

Parameters:
value - Input data.
arg1 - ????
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getURL

public java.net.URL getURL(java.lang.String value)
                    throws java.sql.SQLException
Returns the URL value of the input string.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getBlob

public java.sql.Blob getBlob(java.lang.String value)
                      throws java.sql.SQLException
Returns the input string as a Blob.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getClob

public java.sql.Clob getClob(java.lang.String value)
                      throws java.sql.SQLException
Returns the input string as a Clob.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getDate

public java.sql.Date getDate(java.lang.String value)
                      throws java.sql.SQLException
Returns the input string as a Date object.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getRef

public java.sql.Ref getRef(java.lang.String value)
                    throws java.sql.SQLException
Returns the input string as a Ref.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getTime

public java.sql.Time getTime(java.lang.String value)
                      throws java.sql.SQLException
Returns the input string as a Time object.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getTimestamp

public java.sql.Timestamp getTimestamp(java.lang.String value)
                                throws java.sql.SQLException
Returns the input string as a Timestamp object.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getDate

public java.sql.Date getDate(java.lang.String value,
                             java.util.Calendar calendar)
                      throws java.sql.SQLException
Returns the input string as a Date object, using a specific Calendar.

Parameters:
value - Input data.
calendar - Calendar to use for the conversion.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getTime

public java.sql.Time getTime(java.lang.String value,
                             java.util.Calendar calendar)
                      throws java.sql.SQLException
Returns the input string as a Time object.

Parameters:
value - Input data.
calendar - Calendar to use for the conversion.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getTimestamp

public java.sql.Timestamp getTimestamp(java.lang.String value,
                                       java.util.Calendar calendar)
                                throws java.sql.SQLException
Returns the input string as a Timestamp object.

Parameters:
value - Input data.
calendar - Calendar to use for the conversion.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.

getArray

public java.sql.Array getArray(java.lang.String value)
                        throws java.sql.SQLException
Converts the input string into an array of objects.

Parameters:
value - Input data.
Returns:
converted input.
Throws:
java.sql.SQLException - if there was a problem with the conversion.
java.lang.UnsupportedOperationException - always.