com.ibm.jtopenlite.ddm
Class DDMField

java.lang.Object
  extended by com.ibm.jtopenlite.ddm.DDMField

public final class DDMField
extends Object

Represents an individual field of a record format.


Field Summary
static char TYPE_BINARY
           
static char TYPE_BINARY_CHARACTER
           
static char TYPE_CHARACTER
           
static char TYPE_DATE
           
static char TYPE_DBCS_EITHER
           
static char TYPE_DBCS_GRAPHIC
           
static char TYPE_DBCS_ONLY
           
static char TYPE_DBCS_OPEN
           
static char TYPE_DECIMAL_FLOAT
           
static char TYPE_FLOAT
           
static char TYPE_HEXADECIMAL
           
static char TYPE_PACKED_DECIMAL
           
static char TYPE_TIME
           
static char TYPE_TIMESTAMP
           
static char TYPE_ZONED_DECIMAL
           
 
Method Summary
 int getAllocatedLength()
          Returns the database allocated length (WHALLC) of this field.
 byte getByte(byte[] recordData)
          Converts the specified record data at this field's offset into a byte value, if possible.
 byte[] getBytes(byte[] recordData)
          Returns an array of bytes that is only this field's data, which is a subset of the specified record data.
 int getCCSID()
          Returns the CCSID (WHCCSID) of this field.
 boolean getDate(byte[] recordData, Calendar cal)
          Converts the specified record data at this field's offset into a date, time, or timestamp, if possible, and sets the appropriate fields in the provided Calendar object.
 String getDateTimeFormat()
          Returns the date/time format (WHFMT) of this field.
 String getDateTimeSeparator()
          Returns the date/time separator (WHSEP) of this field.
 int getDecimalPositions()
          Returns the number of decimal positions (WHFLDP) of this field.
 String getDefaultValue()
          Returns the default value (WHDFT) of this field.
 double getDouble(byte[] recordData)
          Converts the specified record data at this field's offset into a double value, if possible.
 float getFloat(byte[] recordData)
          Converts the specified record data at this field's offset into a float value, if possible.
 int getInt(byte[] recordData)
          Converts the specified record data at this field's offset into an int value, if possible.
 int getLength()
          Returns the length (WHFLDB) of this field.
 long getLong(byte[] recordData)
          Converts the specified record data at this field's offset into a long value, if possible.
 String getName()
          Returns the name (WHFLDE) of this field.
 int getNumberOfDigits()
          Returns the total number of digits (WHFLDO) of this field.
 int getOffset()
          Returns the offset in the record data where this field begins.
 short getShort(byte[] recordData)
          Converts the specified record data at this field's offset into a short value, if possible.
 String getString(byte[] recordData)
          Converts the specified record data at this field's offset directly into a String value, if possible.
 String getText()
          Returns the text description (WHFTXT) of this field.
 char getType()
          Returns the type (WHFLDT) of this field.
 boolean isCacheStrings()
          Indicates if getString() will cache previously created String values for memory conservation.
 boolean isNullAllowed()
          Indicates if this field allows null values (WHNULL).
 boolean isVariableLength()
          Indicates if this field is variable length (WHVARL).
 DDMField newCopy()
          Returns a new copy of this field, which is useful if multiple threads need to operate on the same field without contention, as this class is not threadsafe.
 void setByte(byte value, byte[] recordData)
          Converts the specified byte value into record data for this field's type at this field's offset, if possible.
 void setBytes(byte[] value, byte[] recordData)
          Converts the specified byte array value into record data at this field's offset, if possible.
 void setCacheStrings(boolean useCache)
          Enables or disables string caching for this field.
 void setDate(Calendar cal, byte[] recordData)
          Converts the specified Calendar value into record data for this field's type at this field's offset, if possible.
 void setDouble(double value, byte[] recordData)
          Converts the specified double value into record data for this field's type at this field's offset, if possible.
 void setFloat(float value, byte[] recordData)
          Converts the specified float value into record data for this field's type at this field's offset, if possible.
 void setInt(int value, byte[] recordData)
          Converts the specified int value into record data for this field's type at this field's offset, if possible.
 void setLong(long value, byte[] recordData)
          Converts the specified long value into record data for this field's type at this field's offset, if possible.
 void setShort(short value, byte[] recordData)
          Converts the specified short value into record data for this field's type at this field's offset, if possible.
 void setString(String value, byte[] recordData)
          Converts the specified String value into record data for this field's type at this field's offset, if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_CHARACTER

public static final char TYPE_CHARACTER
See Also:
Constant Field Values

TYPE_DBCS_EITHER

public static final char TYPE_DBCS_EITHER
See Also:
Constant Field Values

TYPE_DBCS_GRAPHIC

public static final char TYPE_DBCS_GRAPHIC
See Also:
Constant Field Values

TYPE_DBCS_ONLY

public static final char TYPE_DBCS_ONLY
See Also:
Constant Field Values

TYPE_DBCS_OPEN

public static final char TYPE_DBCS_OPEN
See Also:
Constant Field Values

TYPE_BINARY

public static final char TYPE_BINARY
See Also:
Constant Field Values

TYPE_FLOAT

public static final char TYPE_FLOAT
See Also:
Constant Field Values

TYPE_DECIMAL_FLOAT

public static final char TYPE_DECIMAL_FLOAT
See Also:
Constant Field Values

TYPE_HEXADECIMAL

public static final char TYPE_HEXADECIMAL
See Also:
Constant Field Values

TYPE_BINARY_CHARACTER

public static final char TYPE_BINARY_CHARACTER
See Also:
Constant Field Values

TYPE_DATE

public static final char TYPE_DATE
See Also:
Constant Field Values

TYPE_PACKED_DECIMAL

public static final char TYPE_PACKED_DECIMAL
See Also:
Constant Field Values

TYPE_ZONED_DECIMAL

public static final char TYPE_ZONED_DECIMAL
See Also:
Constant Field Values

TYPE_TIME

public static final char TYPE_TIME
See Also:
Constant Field Values

TYPE_TIMESTAMP

public static final char TYPE_TIMESTAMP
See Also:
Constant Field Values
Method Detail

newCopy

public DDMField newCopy()
Returns a new copy of this field, which is useful if multiple threads need to operate on the same field without contention, as this class is not threadsafe.


getName

public String getName()
Returns the name (WHFLDE) of this field.


getType

public char getType()
Returns the type (WHFLDT) of this field.


getLength

public int getLength()
Returns the length (WHFLDB) of this field.


getOffset

public int getOffset()
Returns the offset in the record data where this field begins.


getText

public String getText()
Returns the text description (WHFTXT) of this field.


getCCSID

public int getCCSID()
Returns the CCSID (WHCCSID) of this field.


getDefaultValue

public String getDefaultValue()
Returns the default value (WHDFT) of this field.


isVariableLength

public boolean isVariableLength()
Indicates if this field is variable length (WHVARL).


isNullAllowed

public boolean isNullAllowed()
Indicates if this field allows null values (WHNULL).


getAllocatedLength

public int getAllocatedLength()
Returns the database allocated length (WHALLC) of this field.


getNumberOfDigits

public int getNumberOfDigits()
Returns the total number of digits (WHFLDO) of this field.


getDecimalPositions

public int getDecimalPositions()
Returns the number of decimal positions (WHFLDP) of this field.


getDateTimeFormat

public String getDateTimeFormat()
Returns the date/time format (WHFMT) of this field.


getDateTimeSeparator

public String getDateTimeSeparator()
Returns the date/time separator (WHSEP) of this field.


isCacheStrings

public boolean isCacheStrings()
Indicates if getString() will cache previously created String values for memory conservation. This can be extremely helpful for fields that contain a finite number of distinct values across all the records in the file.

See Also:
setCacheStrings(boolean)

setCacheStrings

public void setCacheStrings(boolean useCache)
Enables or disables string caching for this field. If enabled, getString() will cache previously created String values for the purposes of conserving memory. This can be extremely helpful for fields that contain a finite number of distinct values across all the records in the file.


getLong

public long getLong(byte[] recordData)
             throws IOException
Converts the specified record data at this field's offset into a long value, if possible.

Throws:
IOException

getShort

public short getShort(byte[] recordData)
               throws IOException
Converts the specified record data at this field's offset into a short value, if possible.

Throws:
IOException

getInt

public int getInt(byte[] recordData)
           throws IOException
Converts the specified record data at this field's offset into an int value, if possible.

Throws:
IOException

getByte

public byte getByte(byte[] recordData)
             throws IOException
Converts the specified record data at this field's offset into a byte value, if possible.

Throws:
IOException

getBytes

public byte[] getBytes(byte[] recordData)
                throws IOException
Returns an array of bytes that is only this field's data, which is a subset of the specified record data.

Throws:
IOException

setBytes

public void setBytes(byte[] value,
                     byte[] recordData)
              throws IOException
Converts the specified byte array value into record data at this field's offset, if possible.

Throws:
IOException

getFloat

public float getFloat(byte[] recordData)
               throws IOException
Converts the specified record data at this field's offset into a float value, if possible.

Throws:
IOException

getDouble

public double getDouble(byte[] recordData)
                 throws IOException
Converts the specified record data at this field's offset into a double value, if possible.

Throws:
IOException

getString

public String getString(byte[] recordData)
                 throws IOException
Converts the specified record data at this field's offset directly into a String value, if possible.

Throws:
IOException

getDate

public boolean getDate(byte[] recordData,
                       Calendar cal)
                throws IOException
Converts the specified record data at this field's offset into a date, time, or timestamp, if possible, and sets the appropriate fields in the provided Calendar object.

Returns:
true if the field data was converted and set into the Calendar object; false otherwise.
Throws:
IOException

setDate

public void setDate(Calendar cal,
                    byte[] recordData)
             throws IOException
Converts the specified Calendar value into record data for this field's type at this field's offset, if possible.

Throws:
IOException

setString

public void setString(String value,
                      byte[] recordData)
               throws IOException
Converts the specified String value into record data for this field's type at this field's offset, if possible.

Throws:
IOException

setDouble

public void setDouble(double value,
                      byte[] recordData)
               throws IOException
Converts the specified double value into record data for this field's type at this field's offset, if possible.

Throws:
IOException

setFloat

public void setFloat(float value,
                     byte[] recordData)
              throws IOException
Converts the specified float value into record data for this field's type at this field's offset, if possible.

Throws:
IOException

setByte

public void setByte(byte value,
                    byte[] recordData)
             throws IOException
Converts the specified byte value into record data for this field's type at this field's offset, if possible.

Throws:
IOException

setShort

public void setShort(short value,
                     byte[] recordData)
              throws IOException
Converts the specified short value into record data for this field's type at this field's offset, if possible.

Throws:
IOException

setInt

public void setInt(int value,
                   byte[] recordData)
            throws IOException
Converts the specified int value into record data for this field's type at this field's offset, if possible.

Throws:
IOException

setLong

public void setLong(long value,
                    byte[] recordData)
             throws IOException
Converts the specified long value into record data for this field's type at this field's offset, if possible.

Throws:
IOException