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
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 java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
binaryConversion
protected boolean binaryConversion
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.
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
- ObjectconversionType
- Stringwriter
- Writerdescriptor
- 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
- ObjectconversionType
- Stringwriter
- Writerdescriptor
- PropertyDescriptorlocale
- 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
- ReaderconversionType
- Stringdescriptor
- 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
- ReaderconversionType
- Stringdescriptor
- PropertyDescriptionlocale
- Locale- Throws:
- java.io.IOException - if an I/O error occurred.
- DSETypeException - Unformatting is unsuccessful.