Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.jzos.fields
Class DatatypeFactory

    java.lang.Object
      com.ibm.jzos.fields.DatatypeFactory

Direct Known Subclasses:
  AssemblerDatatypeFactory, CobolDatatypeFactory

    public abstract class DatatypeFactory

extends java.lang.Object

An abstract class for classes which are used to construct `Field` objects. A running offset to the next field is maintained, along with a stack which can be used to push and pop the current Field offset. A DatatypeFactory is typically used to statically initialize static Field variables in a Java class which maps a record described by a byte array. For an example, see `Format1DSCB`.

Field Summary
`protected int` | `maximumOffset`
`protected int` | `offset`
`protected java.lang.String` | `stringEncoding`
`protected boolean` | `stringTrimDefault`

Constructor Summary
`DatatypeFactory()`

Method Summary
`protected void` | `advanceOffset(Field field)` Increments the current Field offset by the length a Field
`ByteArrayField` | `getByteArrayField(int length)` Construct and return a ByteArrayField, advancing the current offset by its byte length.
`ExternalDecimalAsBigDecimalField` | `getExternalDecimalAsBigDecimalField(int precision, int scale, boolean signed)` Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.
`ExternalDecimalAsBigDecimalField` | `getExternalDecimalAsBigDecimalField(int precision, int scale, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)` Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.
`ExternalDecimalAsBigIntegerField` | `getExternalDecimalAsBigIntegerField(int precision, boolean signed)` Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.
`ExternalDecimalAsBigIntegerField` | `getExternalDecimalAsBigIntegerField(int precision, int scale, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)` Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.
`ExternalDecimalAsIntField` | `getExternalDecimalAsIntField(int precision, boolean signed)` Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.
`ExternalDecimalAsIntField` | `getExternalDecimalAsIntField(int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)` Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.
`ExternalDecimalAsLongField` | `getExternalDecimalAsLongField(int precision, boolean signed)` Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.
`ExternalDecimalAsLongField` | `getExternalDecimalAsLongField(int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)` Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.
`int` | `getMaximumOffset()` Answer the maximum value of the offset
`int` | `getOffset()` Answer the current (next) Field offset
`java.lang.String` | `getStringEncoding()` Gets the current String encoding used for construction of StringFields.
`StringField` | `getStringField(int length)` Construct and return a StringField, advancing the current offset by its byte length.
`StringField` | `getStringField(int length, boolean trim)` Construct and return a StringField, advancing the current offset by its byte length.
`StringField` | `getStringField(int length, boolean trim, boolean padLeft)` Construct and return a StringField, advancing the current offset by its byte length.
`StringField` | `getStringField(int length, boolean trim, boolean padLeft, boolean allowTruncation)` Construct and return a StringField, advancing the current offset by its byte length.
`StringField` | `getStringField(int length, boolean trim, boolean padLeft, boolean allowTruncation, java.lang.String encoding)` Construct and return a StringField, advancing the current offset by its byte length.
`boolean` | `getStringTrimDefault()` Answer the default setting for StringField trimming if not explicitly given.
`void` | `incrementOffset(int amount)` Increments the current Field offset
`void` | `popOffset()` Pop the Field offset from the top of an internal stack.
`void` | `pushOffset()` Push the current Field offset onto an internal stack.
`void` | `setOffset(int offset)`
`void` | `setStringEncoding(java.lang.String stringEncoding)`
`void` | `setStringTrimDefault(boolean value)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### offset

    protected int offset

### maximumOffset

    protected int maximumOffset

### stringEncoding

    protected java.lang.String stringEncoding

### stringTrimDefault

    protected boolean stringTrimDefault

Constructor Detail

### DatatypeFactory

    public DatatypeFactory()

Method Detail

### getOffset

    public int getOffset()

  Answer the current (next) Field offset

  Returns:
    int

### getMaximumOffset

    public int getMaximumOffset()

  Answer the maximum value of the offset

### setOffset

    public void setOffset(int offset)

  See Also:
    `getOffset()`

### pushOffset

    public void pushOffset()

  Push the current Field offset onto an internal stack.

  See Also:
    `popOffset()`

### popOffset

    public void popOffset()

  Pop the Field offset from the top of an internal stack.

  See Also:
    `pushOffset()`

### incrementOffset

    public void incrementOffset(int amount)

  Increments the current Field offset

  Parameters:
    `amount` - int

### advanceOffset

    protected void advanceOffset(Field field)

  Increments the current Field offset by the length a Field

  Parameters:
    `field` - Field

### getStringEncoding

    public java.lang.String getStringEncoding()

  Gets the current String encoding used for construction of StringFields. By default, this is null, meaning that the StringField determines the encoding.

  Returns:
    String
  See Also:
    `StringField.getEncoding()`

### getStringTrimDefault

    public boolean getStringTrimDefault()

  Answer the default setting for StringField trimming if not explicitly given. Default is false.

### setStringTrimDefault

    public void setStringTrimDefault(boolean value)

  See Also:
    `getStringTrimDefault()`

### setStringEncoding

    public void setStringEncoding(java.lang.String stringEncoding)

  See Also:
    `getStringEncoding()`

### getExternalDecimalAsBigDecimalField

    public ExternalDecimalAsBigDecimalField getExternalDecimalAsBigDecimalField(int precision,
                                                                                int scale,
                                                                                boolean signed)

  Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `scale` - the number of implied decimal digits to the right of the decimal point
    `signed` - boolean true if the value is signed
  Returns:
    ExternalDecimalAsBigDecimalField
  See Also:
    `ExternalDecimalAsBigDecimalField.ExternalDecimalAsBigDecimalField(int, int, int, boolean, boolean, boolean, boolean)`

### getExternalDecimalAsBigDecimalField

    public ExternalDecimalAsBigDecimalField getExternalDecimalAsBigDecimalField(int precision,
                                                                                int scale,
                                                                                boolean signed,
                                                                                boolean signTrailing,
                                                                                boolean signExternal,
                                                                                boolean blankWhenZero)

  Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `scale` - the number of implied decimal digits to the right of the decimal point
    `signed` - boolean true if the value is signed
    `signTrailing` - true if the sign is stored at the end of the field
    `signExternal` - true if the sign is stored in a separate byte
    `blankWhenZero` - true if the field is all spaces when zero
  Returns:
    ExternalDecimalAsBigDecimalField
  See Also:
    `ExternalDecimalAsBigDecimalField.ExternalDecimalAsBigDecimalField(int, int, int, boolean, boolean, boolean, boolean)`

### getExternalDecimalAsBigIntegerField

    public ExternalDecimalAsBigIntegerField getExternalDecimalAsBigIntegerField(int precision,
                                                                                boolean signed)

  Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `signed` - boolean true if the value is signed
  Returns:
    ExternalDecimalAsBigIntegerField
  See Also:
    `ExternalDecimalAsBigIntegerField.ExternalDecimalAsBigIntegerField(int, int, int, boolean, boolean, boolean, boolean)`

### getExternalDecimalAsBigIntegerField

    public ExternalDecimalAsBigIntegerField getExternalDecimalAsBigIntegerField(int precision,
                                                                                int scale,
                                                                                boolean signed,
                                                                                boolean signTrailing,
                                                                                boolean signExternal,
                                                                                boolean blankWhenZero)

  Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `scale` - the number of implied decimal digits to the right of the decimal point
    `signed` - boolean true if the value is signed
    `signTrailing` - true if the sign is stored at the end of the field
    `signExternal` - true if the sign is stored in a separate byte
    `blankWhenZero` - true if the field is all spaces when zero
  Returns:
    ExternalDecimalAsBigIntegerField
  See Also:
    `ExternalDecimalAsBigIntegerField.ExternalDecimalAsBigIntegerField(int, int, int, boolean, boolean, boolean, boolean)`

### getExternalDecimalAsIntField

    public ExternalDecimalAsIntField getExternalDecimalAsIntField(int precision,
                                                                  boolean signed)

  Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `signed` - boolean true if the value is signed
  Returns:
    ExternalDecimalAsIntField
  See Also:
    `ExternalDecimalAsIntField.ExternalDecimalAsIntField(int, int, boolean, boolean, boolean, boolean)`

### getExternalDecimalAsIntField

    public ExternalDecimalAsIntField getExternalDecimalAsIntField(int precision,
                                                                  boolean signed,
                                                                  boolean signTrailing,
                                                                  boolean signExternal,
                                                                  boolean blankWhenZero)

  Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `signed` - boolean true if the value is signed
    `signTrailing` - true if the sign is stored at the end of the field
    `signExternal` - true if the sign is stored in a separate byte
    `blankWhenZero` - true if the field is all spaces when zero
  Returns:
    ExternalDecimalAsIntField
  See Also:
    `ExternalDecimalAsIntField.ExternalDecimalAsIntField(int, int, boolean, boolean, boolean, boolean)`

### getExternalDecimalAsLongField

    public ExternalDecimalAsLongField getExternalDecimalAsLongField(int precision,
                                                                    boolean signed)

  Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `signed` - boolean true if the value is signed
  Returns:
    ExternalDecimalAsLongField
  See Also:
    `ExternalDecimalAsLongField.ExternalDecimalAsLongField(int, int, boolean, boolean, boolean, boolean)`

### getExternalDecimalAsLongField

    public ExternalDecimalAsLongField getExternalDecimalAsLongField(int precision,
                                                                    boolean signed,
                                                                    boolean signTrailing,
                                                                    boolean signExternal,
                                                                    boolean blankWhenZero)

  Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.

  Parameters:
    `precision` - the number of decimal digits of precision
    `signed` - boolean true if the value is signed
    `signTrailing` - true if the sign is stored at the end of the field
    `signExternal` - true if the sign is stored in a separate byte
    `blankWhenZero` - true if the field is all spaces when zero
  Returns:
    ExternalDecimalAsLongField
  See Also:
    `ExternalDecimalAsLongField.ExternalDecimalAsLongField(int, int, boolean, boolean, boolean, boolean)`

### getByteArrayField

    public ByteArrayField getByteArrayField(int length)

  Construct and return a ByteArrayField, advancing the current offset by its byte length.

  Parameters:
    `length` - the size of the field in bytes
  Returns:
    ByteArrayField
  See Also:
    `ByteArrayField.ByteArrayField(int, int)`

### getStringField

    public StringField getStringField(int length)

  Construct and return a StringField, advancing the current offset by its byte length.

  Parameters:
    `length` - the length of the field in bytes.
  Returns:
    StringField

### getStringField

    public StringField getStringField(int length,
                                      boolean trim)

  Construct and return a StringField, advancing the current offset by its byte length.

  Parameters:
    `length` -
    `trim` -
  Returns:
    StringField
  See Also:
    `StringField.StringField(int, int, boolean)`

### getStringField

    public StringField getStringField(int length,
                                      boolean trim,
                                      boolean padLeft,
                                      boolean allowTruncation,
                                      java.lang.String encoding)

  Construct and return a StringField, advancing the current offset by its byte length.

  Parameters:
    `length` - the length of the field in bytes.
    `trim` - true if the String returned from the underlying byte array is to be trimmed of leading (padLeft == true) or trailing (padLeft == false) blanks.
    `padLeft` - true if small values are to be left padded with blanks
    `allowTruncation` - true if large Strings are to be right truncated. If false an IllegalArgumentException will be thrown.
    `encoding` - the character set encoding. This is assumed to be an EBCDIC variant.
  Returns:
    StringField

### getStringField

    public StringField getStringField(int length,
                                      boolean trim,
                                      boolean padLeft,
                                      boolean allowTruncation)

  Construct and return a StringField, advancing the current offset by its byte length.

  Parameters:
    `length` - the length of the field in bytes.
    `trim` - true if the String returned from the underlying byte array is to be trimmed of leading (padLeft == true) or trailing (padLeft == false) blanks.
    `padLeft` - true if small values are to be left padded with blanks
    `allowTruncation` - true if large Strings are to be right truncated. If false an IllegalArgumentException will be thrown.
  Returns:
    StringField

### getStringField

    public StringField getStringField(int length,
                                      boolean trim,
                                      boolean padLeft)

  Construct and return a StringField, advancing the current offset by its byte length.

  Parameters:
    `length` - the length of the field in bytes.
    `trim` - true if the String returned from the underlying byte array is to be trimmed of leading (padLeft == true) or trailing (padLeft == false) blanks.
    `padLeft` - true if small values are to be left padded with blanks
  Returns:
    StringField

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD