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

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

public class IntegerConverter
extends AbstractConverter

Converter for business objects of Type Integer or Long. The size of its representation can be set from 1 to 8. The byteOrdering attribute can be set to have it in big-endian (host) or little-endian (PC) byte ordering. The sign attribute can be set to work with or without sign.

See Also:
Serialized Form

Field Summary
protected  boolean binaryConversion
           
 
Fields inherited from class com.ibm.dse.base.types.AbstractConverter
keyValuePairs
 
Constructor Summary
IntegerConverter(java.lang.String[] supportedConversionTypes, java.util.Hashtable keyValuePairs)
          Creates an IntegerConverter object.
 
Method Summary
protected  void formatToWriter(long value, java.io.Writer writer, int aByteOrdering, int aSize)
           
 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, locale and writer passed as argument.
 int getByteOrdering()
          Returns the value of byteOrdering.
 boolean getSign()
          Returns the value of sign.
 int getSize()
          Returns the value of size.
protected  long parse(java.lang.String aString, int aByteOrdering, int aSize, boolean aSign)
          Converts aString to a char[] and then converts the char[] to a Java long.
 java.lang.Object unformatFromReaderForType(java.io.Reader reader, java.lang.String conversionType, PropertyDescription descriptor)
          Converts the stream passed to a Byte, Short, Integer or Long 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)
          Uses the reader passed to construct an Object of the correct Type using the appropriate conversion type and locale.
 
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

IntegerConverter

public IntegerConverter(java.lang.String[] supportedConversionTypes,
                        java.util.Hashtable keyValuePairs)
                 throws DSETypeException
Creates an IntegerConverter object.
Parameters:
supportedConversionTypes - java.lang.String[]
keyValuePairs - java.util.Hashtable
Throws:
DSETypeException - Conversion types passed to superclass is null or empty.
Method Detail

formatToWriter

protected void formatToWriter(long value,
                              java.io.Writer writer,
                              int aByteOrdering,
                              int aSize)
                       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 - PropertyDescription
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, locale and 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 - if an I/O error occurred.
DSETypeException - Unformatting is unsuccessful.

getByteOrdering

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

getSign

public boolean getSign()
Returns the value of sign.
Returns:
boolean

getSize

public int getSize()
Returns the value of size.
Returns:
int

parse

protected long parse(java.lang.String aString,
                     int aByteOrdering,
                     int aSize,
                     boolean aSign)
Converts aString to a char[] and then converts the char[] to a Java long.
Parameters:
aString - java.lang.String
Returns:
long

unformatFromReaderForType

public java.lang.Object unformatFromReaderForType(java.io.Reader reader,
                                                  java.lang.String conversionType,
                                                  PropertyDescription descriptor)
                                           throws java.io.IOException,
                                                  DSETypeException
Converts the stream passed to a Byte, Short, Integer or Long depending on the size attribute, 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:
java.io.IOException - if an I/O error occurred.
DSETypeException - Unformatting is unsuccessful.

unformatFromReaderForType

public java.lang.Object unformatFromReaderForType(java.io.Reader reader,
                                                  java.lang.String conversionType,
                                                  PropertyDescription descriptor,
                                                  java.util.Locale locale)
                                           throws java.io.IOException,
                                                  DSETypeException
Uses the reader passed to construct an Object of the correct Type using the appropriate conversion type and locale. 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 - PropertyDescription
locale - Locale
Throws:
java.io.IOException - if an I/O error occurred.
DSETypeException - Unformatting is unsuccessful.