com.ibm.as400.access
Interface AS400DataType
-
- All Superinterfaces:
- java.lang.Cloneable, java.io.Serializable
- All Known Implementing Classes:
- AS400AbstractTime, AS400Array, AS400Bin1, AS400Bin2, AS400Bin4, AS400Bin8, AS400ByteArray, AS400Date, AS400DecFloat, AS400Float4, AS400Float8, AS400PackedDecimal, AS400Structure, AS400Text, AS400Time, AS400Timestamp, AS400UnsignedBin1, AS400UnsignedBin2, AS400UnsignedBin4, AS400UnsignedBin8, AS400Varchar, AS400ZonedDecimal
public interface AS400DataType extends java.lang.Cloneable, java.io.Serializable
Provides an interface for conversions between Java objects and byte arrays representing IBM i data types.
-
-
Field Summary
Fields Modifier and Type Field and Description static long
serialVersionUID
static int
TYPE_ARRAY
Constant representing the instance of this class is anAS400Array
object.static int
TYPE_BIN1
Constant representing the instance of this class is anAS400Bin1
object.static int
TYPE_BIN2
Constant representing the instance of this class is anAS400Bin2
object.static int
TYPE_BIN4
Constant representing the instance of this class is anAS400Bin4
object.static int
TYPE_BIN8
Constant representing the instance of this class is anAS400Bin8
object.static int
TYPE_BYTE_ARRAY
Constant representing the instance of this class is anAS400ByteArray
object.static int
TYPE_DATE
Constant representing the instance of this class is anAS400Date
object.static int
TYPE_DECFLOAT
Constant representing the instance of this class is anAS400DecFloat
object.static int
TYPE_FLOAT4
Constant representing the instance of this class is anAS400Float4
object.static int
TYPE_FLOAT8
Constant representing the instance of this class is anAS400Float8
object.static int
TYPE_PACKED
Constant representing the instance of this class is anAS400PackedDecimal
object.static int
TYPE_STRUCTURE
Constant representing the instance of this class is anAS400Structure
object.static int
TYPE_TEXT
Constant representing the instance of this class is anAS400Text
object.static int
TYPE_TIME
Constant representing the instance of this class is anAS400Time
object.static int
TYPE_TIME_OF_DAY
Deprecated.UseTYPE_TIME
instead.static int
TYPE_TIMESTAMP
Constant representing the instance of this class is anAS400Timestamp
object.static int
TYPE_UBIN1
Constant representing the instance of this class is anAS400UnsignedBin1
object.static int
TYPE_UBIN2
Constant representing the instance of this class is anAS400UnsignedBin2
object.static int
TYPE_UBIN4
Constant representing the instance of this class is anAS400UnsignedBin4
object.static int
TYPE_UBIN8
Constant representing the instance of this class is anAS400UnsignedBin8
object.static int
TYPE_VARCHAR
Constant representing the instance of this class is anAS400Varchar
object.static int
TYPE_ZONED
Constant representing the instance of this class is anAS400ZonedDecimal
object.
-
Method Summary
Methods Modifier and Type Method and Description java.lang.Object
clone()
Creates a new AS400DataType object that is identical to the current instance.int
getByteLength()
Returns the byte length of the data type.java.lang.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.java.lang.Class
getJavaType()
Returns the Java class that corresponds with this data type.byte[]
toBytes(java.lang.Object javaValue)
Converts the specified Java object to IBM i format.int
toBytes(java.lang.Object javaValue, byte[] as400Value)
Converts the specified Java object into IBM i format in the specified byte array.int
toBytes(java.lang.Object javaValue, byte[] as400Value, int offset)
Converts the specified Java object into IBM i format in the specified byte array.java.lang.Object
toObject(byte[] as400Value)
Converts the specified IBM i data type to a Java object.java.lang.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 anAS400Array
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_BIN2
static final int TYPE_BIN2
Constant representing the instance of this class is anAS400Bin2
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_BIN4
static final int TYPE_BIN4
Constant representing the instance of this class is anAS400Bin4
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_BIN8
static final int TYPE_BIN8
Constant representing the instance of this class is anAS400Bin8
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_BYTE_ARRAY
static final int TYPE_BYTE_ARRAY
Constant representing the instance of this class is anAS400ByteArray
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_FLOAT4
static final int TYPE_FLOAT4
Constant representing the instance of this class is anAS400Float4
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_FLOAT8
static final int TYPE_FLOAT8
Constant representing the instance of this class is anAS400Float8
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_PACKED
static final int TYPE_PACKED
Constant representing the instance of this class is anAS400PackedDecimal
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_STRUCTURE
static final int TYPE_STRUCTURE
Constant representing the instance of this class is anAS400Structure
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_TEXT
static final int TYPE_TEXT
Constant representing the instance of this class is anAS400Text
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_UBIN2
static final int TYPE_UBIN2
Constant representing the instance of this class is anAS400UnsignedBin2
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_UBIN4
static final int TYPE_UBIN4
Constant representing the instance of this class is anAS400UnsignedBin4
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_ZONED
static final int TYPE_ZONED
Constant representing the instance of this class is anAS400ZonedDecimal
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_DECFLOAT
static final int TYPE_DECFLOAT
Constant representing the instance of this class is anAS400DecFloat
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_BIN1
static final int TYPE_BIN1
Constant representing the instance of this class is anAS400Bin1
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_UBIN1
static final int TYPE_UBIN1
Constant representing the instance of this class is anAS400UnsignedBin1
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_UBIN8
static final int TYPE_UBIN8
Constant representing the instance of this class is anAS400UnsignedBin8
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_DATE
static final int TYPE_DATE
Constant representing the instance of this class is anAS400Date
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_TIME
static final int TYPE_TIME
Constant representing the instance of this class is anAS400Time
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_TIME_OF_DAY
static final int TYPE_TIME_OF_DAY
Deprecated. UseTYPE_TIME
instead.- See Also:
- Constant Field Values
-
TYPE_TIMESTAMP
static final int TYPE_TIMESTAMP
Constant representing the instance of this class is anAS400Timestamp
object.- See Also:
getInstanceType()
, Constant Field Values
-
TYPE_VARCHAR
static final int TYPE_VARCHAR
Constant representing the instance of this class is anAS400Varchar
object.- See Also:
getInstanceType()
, Constant Field Values
-
-
Method Detail
-
clone
java.lang.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
java.lang.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
java.lang.Class getJavaType()
Returns the Java class that corresponds with this data type.- Returns:
- The corresponding Java class for this data type.
-
toBytes
byte[] toBytes(java.lang.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(java.lang.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(java.lang.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
java.lang.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
java.lang.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.
-
-