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.

    Since:
    2.1.0
    • 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
      • 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.
      • setStringEncoding

        public void setStringEncoding(java.lang.String stringEncoding)
        See Also:
        getStringEncoding()
      • 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 in the fractional part of the field
        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,
                                                                           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 in the fractional part of the field
        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,
                                                             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,
                                                               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,
                                 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
© Copyright IBM Corporation 2005, 2014.