com.ibm.dse.base.types.ext
Class FloatConverter

java.lang.Object
  |
  +--com.ibm.dse.base.types.AbstractConverter
        |
        +--com.ibm.dse.base.types.ext.FloatConverter

public class FloatConverter
extends AbstractConverter

Converter for business objects of Type Float or Double . The size of its representation is float (4 bytes) or double precision (8 bytes). The byteOrdering attribute can be set to have it in big-endian (host) or little-endian (PC) byte ordering.

See Also:
Serialized Form

Field Summary
protected  boolean binaryConversion
           
 
Fields inherited from class com.ibm.dse.base.types.AbstractConverter
keyValuePairs
 
Constructor Summary
FloatConverter(java.lang.String[] supportedConversionTypes, java.util.Hashtable keyValuePairs)
          This constructor creates a FloatConverter which supports the conversion types passed as argument.
 
Method Summary
protected  void formatToWriter(double value, java.io.Writer writer, int aByteOrdering)
           
protected  void formatToWriter(float value, java.io.Writer writer, int aByteOrdering)
           
 void formatToWriterForType(java.lang.Object value, java.lang.String conversionType, java.io.Writer writer, PropertyDescription descriptor)
          The value passed as an Object is formatted using the specified conversion type and written to the writer passed as argument.
 void formatToWriterForType(java.lang.Object value, java.lang.String conversionType, java.io.Writer writer, PropertyDescription descriptor, java.util.Locale locale)
          The value passed as an Object is formatted using the specified conversion type and written to the writer passed as argument.
 int getByteOrdering()
          Gets the byteOrdering attribute.
 int getSize()
          Gets the size attribute.
protected  double parseToDouble(java.lang.String aString, int aByteOrdering)
          Obtains a double from the String used as the double's internal byte-representation.
protected  float parseToFloat(java.lang.String aString, int aByteOrdering)
          Obtains a float from the String used as the float's internal byte-representation.
 void setSize(int aSize)
          Sets the value of the size attribute.
 java.lang.Object unformatFromReaderForType(java.io.Reader reader, java.lang.String conversionType, PropertyDescription descriptor)
          Converts the stream passed to a Float or Double depending on its size, using the appropriate conversion Type.
 java.lang.Object unformatFromReaderForType(java.io.Reader reader, java.lang.String conversionType, PropertyDescription descriptor, java.util.Locale locale)
          Converts the stream passed to a Float or Double depending on its size, using the appropriate conversion Type.
 
Methods inherited from class com.ibm.dse.base.types.AbstractConverter
formatToWriter, formatToWriter, getParameters, getSupportedConversionTypes, supportsConversionType, unformatFromReader, unformatFromReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

binaryConversion

protected boolean binaryConversion
Constructor Detail

FloatConverter

public FloatConverter(java.lang.String[] supportedConversionTypes,
                      java.util.Hashtable keyValuePairs)
               throws DSETypeException
This constructor creates a FloatConverter which supports the conversion types passed as argument.
Parameters:
supportedConversionTypes - String[]
keyValuePairs - Hashtable
Throws:
DSETypeException - Conversion types passed to superclass is null or empty.
Method Detail

formatToWriter

protected void formatToWriter(double value,
                              java.io.Writer writer,
                              int aByteOrdering)
                       throws java.io.IOException,
                              DSETypeException

formatToWriter

protected void formatToWriter(float value,
                              java.io.Writer writer,
                              int aByteOrdering)
                       throws java.io.IOException,
                              DSETypeException

formatToWriterForType

public void formatToWriterForType(java.lang.Object value,
                                  java.lang.String conversionType,
                                  java.io.Writer writer,
                                  PropertyDescription descriptor)
                           throws java.io.IOException,
                                  DSETypeException
The value passed as an Object is formatted using the specified conversion type and written to the writer passed as argument. Parameters required by this converter are first taken from the owner descriptor passed as argument.
Overrides:
formatToWriterForType in class AbstractConverter
Parameters:
value - Object
conversionType - String
writer - Writer
descriptor - PropertyDescriptor
Throws:
java.io.IOException - An I/O error occurs
DSETypeException - Formatting is unsuccessfull

formatToWriterForType

public void formatToWriterForType(java.lang.Object value,
                                  java.lang.String conversionType,
                                  java.io.Writer writer,
                                  PropertyDescription descriptor,
                                  java.util.Locale locale)
                           throws java.io.IOException,
                                  DSETypeException
The value passed as an Object is formatted using the specified conversion type and written to the writer passed as argument. Parameters required by this converter are first taken from the owner descriptor passed as argument.
Overrides:
formatToWriterForType in class AbstractConverter
Parameters:
value - Object
conversionType - String
writer - Writer
descriptor - PropertyDescriptor
locale - Locale
Throws:
java.io.IOException - An I/O error occurs
DSETypeException - Formatting is unsuccessfull

getByteOrdering

public int getByteOrdering()
Gets the byteOrdering attribute.
Returns:
int

getSize

public int getSize()
Gets the size attribute.
Returns:
int

parseToDouble

protected double parseToDouble(java.lang.String aString,
                               int aByteOrdering)
Obtains a double from the String used as the double's internal byte-representation.
Parameters:
aString - java.lang.String
Returns:
double

parseToFloat

protected float parseToFloat(java.lang.String aString,
                             int aByteOrdering)
Obtains a float from the String used as the float's internal byte-representation.
Parameters:
aString - java.lang.String
Returns:
float

setSize

public void setSize(int aSize)
Sets the value of the size attribute.
Parameters:
aSize - int

unformatFromReaderForType

public java.lang.Object unformatFromReaderForType(java.io.Reader reader,
                                                  java.lang.String conversionType,
                                                  PropertyDescription descriptor)
                                           throws java.io.IOException
Converts the stream passed to a Float or Double depending on its size, using the appropriate conversion Type. Parameters required by this converter are first taken from the owner descriptor passed as argument.
Overrides:
unformatFromReaderForType in class AbstractConverter
Parameters:
reader - Reader
conversionType - String
descriptor - PropertyDescriptor
Returns:
Object
Throws:
IOExcepton - if an I/O error occurred.

unformatFromReaderForType

public java.lang.Object unformatFromReaderForType(java.io.Reader reader,
                                                  java.lang.String conversionType,
                                                  PropertyDescription descriptor,
                                                  java.util.Locale locale)
                                           throws java.io.IOException
Converts the stream passed to a Float or Double depending on its size, using the appropriate conversion Type. Parameters required by this converter are first taken from the owner descriptor passed as argument.
Overrides:
unformatFromReaderForType in class AbstractConverter
Parameters:
reader - Reader
conversionType - String
descriptor - PropertyDescriptor
locale - Locale
Returns:
Object
Throws:
IOExcepton - if an I/O error occurred.