com.ibm.as400.access
Interface AS400DataType

All Superinterfaces:
Cloneable, Serializable
All Known Implementing Classes:
AS400Array, AS400Bin2, AS400Bin4, AS400Bin8, AS400ByteArray, AS400DecFloat, AS400Float4, AS400Float8, AS400PackedDecimal, AS400Structure, AS400Text, AS400UnsignedBin2, AS400UnsignedBin4, AS400ZonedDecimal

public interface AS400DataType
extends Cloneable, Serializable

The AS400DataType interface provides an interface for conversions between Java objects and byte arrays representing IBM i data types.


Field Summary
Modifier and Type Field and Description
static long serialVersionUID
           
static int TYPE_ARRAY
          Constant representing the instance of this class is an AS400Array object.
static int TYPE_BIN2
          Constant representing the instance of this class is an AS400Bin2 object.
static int TYPE_BIN4
          Constant representing the instance of this class is an AS400Bin4 object.
static int TYPE_BIN8
          Constant representing the instance of this class is an AS400Bin8 object.
static int TYPE_BYTE_ARRAY
          Constant representing the instance of this class is an AS400ByteArray object.
static int TYPE_DECFLOAT
          Constant representing the instance of this class is an AS400DecFloat object.
static int TYPE_FLOAT4
          Constant representing the instance of this class is an AS400Float4 object.
static int TYPE_FLOAT8
          Constant representing the instance of this class is an AS400Float8 object.
static int TYPE_PACKED
          Constant representing the instance of this class is an AS400PackedDecimal object.
static int TYPE_STRUCTURE
          Constant representing the instance of this class is an AS400Structure object.
static int TYPE_TEXT
          Constant representing the instance of this class is an AS400Text object.
static int TYPE_UBIN2
          Constant representing the instance of this class is an AS400UnsignedBin2 object.
static int TYPE_UBIN4
          Constant representing the instance of this class is an AS400UnsignedBin4 object.
static int TYPE_ZONED
          Constant representing the instance of this class is an AS400ZonedDecimal object.
 
Method Summary
Modifier and Type Method and Description
 Object clone()
          Creates a new AS400DataType object that is identical to the current instance.
 int getByteLength()
          Returns the byte length of the data type.
 Object getDefaultValue()
          Returns a Java object representing the default value of the data type.
 int getInstanceType()
          Returns an integer constant representing the type of class that implements this interface.
 Class getJavaType()
          Returns the Java class that corresponds with this data type.
 byte[] toBytes(Object javaValue)
          Converts the specified Java object to IBM i format.
 int toBytes(Object javaValue, byte[] as400Value)
          Converts the specified Java object into IBM i format in the specified byte array.
 int toBytes(Object javaValue, byte[] as400Value, int offset)
          Converts the specified Java object into IBM i format in the specified byte array.
 Object toObject(byte[] as400Value)
          Converts the specified IBM i data type to a Java object.
 Object toObject(byte[] as400Value, int offset)
          Converts the specified IBM i data type to a Java object.
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

TYPE_ARRAY

static final int TYPE_ARRAY
Constant representing the instance of this class is an AS400Array object.

See Also:
getInstanceType(), Constant Field Values

TYPE_BIN2

static final int TYPE_BIN2
Constant representing the instance of this class is an AS400Bin2 object.

See Also:
getInstanceType(), Constant Field Values

TYPE_BIN4

static final int TYPE_BIN4
Constant representing the instance of this class is an AS400Bin4 object.

See Also:
getInstanceType(), Constant Field Values

TYPE_BIN8

static final int TYPE_BIN8
Constant representing the instance of this class is an AS400Bin8 object.

See Also:
getInstanceType(), Constant Field Values

TYPE_BYTE_ARRAY

static final int TYPE_BYTE_ARRAY
Constant representing the instance of this class is an AS400ByteArray object.

See Also:
getInstanceType(), Constant Field Values

TYPE_FLOAT4

static final int TYPE_FLOAT4
Constant representing the instance of this class is an AS400Float4 object.

See Also:
getInstanceType(), Constant Field Values

TYPE_FLOAT8

static final int TYPE_FLOAT8
Constant representing the instance of this class is an AS400Float8 object.

See Also:
getInstanceType(), Constant Field Values

TYPE_PACKED

static final int TYPE_PACKED
Constant representing the instance of this class is an AS400PackedDecimal object.

See Also:
getInstanceType(), Constant Field Values

TYPE_STRUCTURE

static final int TYPE_STRUCTURE
Constant representing the instance of this class is an AS400Structure object.

See Also:
getInstanceType(), Constant Field Values

TYPE_TEXT

static final int TYPE_TEXT
Constant representing the instance of this class is an AS400Text object.

See Also:
getInstanceType(), Constant Field Values

TYPE_UBIN2

static final int TYPE_UBIN2
Constant representing the instance of this class is an AS400UnsignedBin2 object.

See Also:
getInstanceType(), Constant Field Values

TYPE_UBIN4

static final int TYPE_UBIN4
Constant representing the instance of this class is an AS400UnsignedBin4 object.

See Also:
getInstanceType(), Constant Field Values

TYPE_ZONED

static final int TYPE_ZONED
Constant representing the instance of this class is an AS400ZonedDecimal object.

See Also:
getInstanceType(), Constant Field Values

TYPE_DECFLOAT

static final int TYPE_DECFLOAT
Constant representing the instance of this class is an AS400DecFloat object.

See Also:
getInstanceType(), Constant Field Values
Method Detail

clone

Object clone()
Creates a new AS400DataType object that is identical to the current instance.

Returns:
The new object.

getByteLength

int getByteLength()
Returns the byte length of the data type.

Returns:
The number of bytes in the IBM i representation of the data type.

getDefaultValue

Object getDefaultValue()
Returns a Java object representing the default value of the data type.

Returns:
The Object of the corresponding data type.

getInstanceType

int getInstanceType()
Returns an integer constant representing the type of class that implements this interface. This is typically faster than using the instanceof operator, and may prove useful where code needs a primitive type for ease of calculation. Possible values for standard com.ibm.as400.access classes that implement this interface are provided as constants in this class. Note that any implementing class provided by a third party is not guaranteed to correctly return one of the pre-defined constants.

Returns:
The type of object implementing this interface.

getJavaType

Class getJavaType()
Returns the Java class that corresponds with this data type.

Returns:
The corresponding Java class for this data type.

toBytes

byte[] toBytes(Object javaValue)
Converts the specified Java object to IBM i format.

Parameters:
javaValue - The object corresponding to the data type. It must be an instance of the correct type.
Returns:
The IBM i representation of the data type.

toBytes

int toBytes(Object javaValue,
            byte[] as400Value)
Converts the specified Java object into IBM i format in the specified byte array.

Parameters:
javaValue - The object corresponding to the data type. It must be an instance of the correct type.
as400Value - The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value.
Returns:
The number of bytes in the IBM i representation of the data type.

toBytes

int toBytes(Object javaValue,
            byte[] as400Value,
            int offset)
Converts the specified Java object into IBM i format in the specified byte array.

Parameters:
javaValue - The object corresponding to the data type. It must be an instance of the correct type.
as400Value - The array to receive the data type in IBM i format. There must be enough space to hold the IBM i value.
offset - The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero.
Returns:
The number of bytes in the IBM i representation of the data type.

toObject

Object toObject(byte[] as400Value)
Converts the specified IBM i data type to a Java object.

Parameters:
as400Value - The array containing the data type in IBM i format. The entire data type must be represented.
Returns:
The object corresponding to the data type.

toObject

Object toObject(byte[] as400Value,
                int offset)
Converts the specified IBM i data type to a Java object.

Parameters:
as400Value - The array containing the data type in IBM i format. The entire data type must be represented.
offset - The offset into the byte array for the start of the IBM i value. It must be greater than or equal to zero.
Returns:
The object corresponding to the data type.