IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

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

java.lang.Object
  extended by com.ibm.btt.base.types.AbstractConverter
      extended by com.ibm.btt.base.types.ext.FloatConverter
All Implemented Interfaces:
Conversion, TypeConstants, java.io.Externalizable, java.io.Serializable

public class FloatConverter
extends AbstractConverter

This is a converter for business objects of Float or Double types. The size of its representation is float (4 bytes) or double precision (8 bytes). The byteOrdering attribute determines whether the instance has big-endian (host) or little-endian (PC) byte ordering.

See Also:
Serialized Form

Field Summary
protected  boolean binaryConversion
           
 
Fields inherited from class com.ibm.btt.base.types.AbstractConverter
keyValuePairs
 
Fields inherited from interface com.ibm.btt.base.types.TypeConstants
amended, CONV_TYPE_DEFAULT, CONV_TYPE_HOST, CONV_TYPE_HTML, CONV_TYPE_OUTPUT, CONV_TYPE_SER, CONV_TYPE_XML, disabled, hidden, isAmended, isDisabled, isHidden, isMandatory, isOmitted, isReadOnly, mandatory, omitted, readOnly, TYPE_DEFAULT, TYPE_REGISTRY_INIT_SIZE
 
Constructor Summary
FloatConverter()
          This constructor creates a FloatConverter object that supports the conversion types passed as an argument.
FloatConverter(java.lang.String[] supportedConversionTypes, java.util.Hashtable keyValuePairs)
          This constructor creates a FloatConverter object that supports the conversion types passed as an 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, Hashtable parameters)
          Formats the Object using the specified conversion type and writer passed as arguments.
 void formatToWriterForType(java.lang.Object value, java.lang.String conversionType, java.io.Writer writer, PropertyDescription descriptor, java.util.Locale locale, Hashtable parameters)
          Formats the Object using the specified conversion type and writer passed as arguments.
 int getByteOrdering()
          Returns the value of the byteOrdering attribute.
 int getSize()
          Returns the value of 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.
protected  java.lang.Object unformat(java.lang.String floatAsString, java.lang.String convType, PropertyDescription descriptor, java.util.Locale locale)
          Converts a String representing a Float into another Float.
protected  java.lang.Object unformat(java.lang.String floatAsString, java.lang.String convType, PropertyDescription descriptor, java.util.Locale locale, Hashtable parameters)
          Converts a String representing a Float into another Float.
 java.lang.Object unformatFromReaderForType(java.io.Reader reader, java.lang.String conversionType, PropertyDescription descriptor, Hashtable parameters)
          Converts the stream into a Float or Double (depending on the size attribute) using the appropriate conversion type.
 java.lang.Object unformatFromReaderForType(java.io.Reader reader, java.lang.String conversionType, PropertyDescription descriptor, java.util.Locale locale, Hashtable parameters)
          Converts the stream passed to a Float or Double (depending on the size attribute) using the appropriate conversion type.
 void validateParams(PropertyDescription pd)
          Validates the parameters externally defined for this converter.
 
Methods inherited from class com.ibm.btt.base.types.AbstractConverter
convertFrom, convertFrom, convertFrom, convertFrom, convertFrom, convertTo, convertTo, convertTo, convertTo, convertTo, formatToWriter, formatToWriter, formatToWriter, formatToWriterForType, formatToWriterForType, getParameters, getSupportedConversionTypes, readExternal, supportsConversionType, unformatFromReader, unformatFromReader, unformatFromReader, unformatFromReader, unformatFromReaderForType, unformatFromReaderForType, writeExternal
 
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()
               throws DSETypeException
This constructor creates a FloatConverter object that supports the conversion types passed as an argument.

Throws:
DSETypeException

FloatConverter

public FloatConverter(java.lang.String[] supportedConversionTypes,
                      java.util.Hashtable keyValuePairs)
               throws DSETypeException
This constructor creates a FloatConverter object that supports the conversion types passed as an argument.

Parameters:
supportedConversionTypes - String[]
keyValuePairs - Hashtable
Throws:
DSETypeException - - If the supportedConversionTypes parameter passed to the superclass is null or empty
Method Detail

formatToWriter

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

formatToWriter

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

formatToWriterForType

public void formatToWriterForType(java.lang.Object value,
                                  java.lang.String conversionType,
                                  java.io.Writer writer,
                                  PropertyDescription descriptor,
                                  Hashtable parameters)
                           throws java.io.IOException,
                                  DSETypeException
Formats the Object using the specified conversion type and writer passed as arguments. This method first tries to get the parameters required for the conversion from the Hashtable passed as an argument. If it does not find the parameters there, the method then tries the descriptor passed as an argument.

Overrides:
formatToWriterForType in class AbstractConverter
Parameters:
value - Object
conversionType - String
writer - Writer
descriptor - PropertyDescriptor
parameters - com.ibm.btt.base.Hashtable
Throws:
java.io.IOException - An I/O error occurs
DSETypeException - - If formatting is unsuccessful

formatToWriterForType

public void formatToWriterForType(java.lang.Object value,
                                  java.lang.String conversionType,
                                  java.io.Writer writer,
                                  PropertyDescription descriptor,
                                  java.util.Locale locale,
                                  Hashtable parameters)
                           throws java.io.IOException,
                                  DSETypeException
Formats the Object using the specified conversion type and writer passed as arguments. The parameters required by this converter are first taken from the Hashtable passed as an argument. If they are not there, they are taken from the descriptor passed as an argument.

Overrides:
formatToWriterForType in class AbstractConverter
Parameters:
value - Object
conversionType - String
writer - Writer
descriptor - PropertyDescriptor
locale - Locale
parameters - com.ibm.btt.base.Hashtable
Throws:
java.io.IOException - - If an I/O error occurs
DSETypeException - - If formatting is unsuccessful

getByteOrdering

public int getByteOrdering()
Returns the value of the byteOrdering attribute.

Returns:
int

getSize

public int getSize()
Returns the value of 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

unformat

protected java.lang.Object unformat(java.lang.String floatAsString,
                                    java.lang.String convType,
                                    PropertyDescription descriptor,
                                    java.util.Locale locale)
                             throws DSETypeException
Converts a String representing a Float into another Float.

Overrides:
unformat in class AbstractConverter
Returns:
java.lang.Object
Throws:
DSETypeException

unformat

protected java.lang.Object unformat(java.lang.String floatAsString,
                                    java.lang.String convType,
                                    PropertyDescription descriptor,
                                    java.util.Locale locale,
                                    Hashtable parameters)
                             throws DSETypeException
Converts a String representing a Float into another Float.

Overrides:
unformat in class AbstractConverter
Returns:
java.lang.Object
Throws:
DSETypeException

unformatFromReaderForType

public java.lang.Object unformatFromReaderForType(java.io.Reader reader,
                                                  java.lang.String conversionType,
                                                  PropertyDescription descriptor,
                                                  Hashtable parameters)
                                           throws java.io.IOException
Converts the stream into a Float or Double (depending on the size attribute) using the appropriate conversion type. The parameters required by this converter are first taken from the Hashtable passed as an argument. If they are not found there, they are taken from the descriptor passed as an argument.

Overrides:
unformatFromReaderForType in class AbstractConverter
Parameters:
reader - Reader
conversionType - String
descriptor - PropertyDescriptor
parameters - com.ibm.btt.base.Hashtable
Returns:
Object
Throws:
IOExcepton - - If an I/O error occurred
java.io.IOException

unformatFromReaderForType

public java.lang.Object unformatFromReaderForType(java.io.Reader reader,
                                                  java.lang.String conversionType,
                                                  PropertyDescription descriptor,
                                                  java.util.Locale locale,
                                                  Hashtable parameters)
                                           throws java.io.IOException
Converts the stream passed to a Float or Double (depending on the size attribute) using the appropriate conversion type. The parameters required by this converter are first taken from the Hashtable passed as an argument. If they are not found there, they are taken from the descriptor passed as an argument.

Overrides:
unformatFromReaderForType in class AbstractConverter
Parameters:
reader - Reader
conversionType - String
descriptor - PropertyDescriptor
locale - Locale
parameters - com.ibm.btt.base.Hashtable
Returns:
Object
Throws:
IOExcepton - - If an I/O error occurred
java.io.IOException

validateParams

public void validateParams(PropertyDescription pd)
                    throws DSETypeException
Validates the parameters externally defined for this converter.

Specified by:
validateParams in interface Conversion
Overrides:
validateParams in class AbstractConverter
Parameters:
pd - com.ibm.btt.base.types.PropertyDescription
Throws:
DSETypeException - - If parameter validation fails

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011