Class FieldDef

  • All Implemented Interfaces:
    Serializable

    public class FieldDef
    extends Object
    implements Serializable
    The name and field type for an item from the HPCC environment. The types may be single scalar types or may be arrays or structures.
    See Also:
    Serialized Form
    • Constructor Detail

      • FieldDef

        public FieldDef​(FieldDef rhs)
        Instantiates a new field def.
        Parameters:
        rhs - FieldDef to be copied
      • FieldDef

        public FieldDef​(String fieldName,
                        FieldType fieldType,
                        String typeName,
                        long len,
                        boolean isFixedLength,
                        boolean isUnsigned,
                        HpccSrcType sourceType,
                        FieldDef[] childDefs)
        Instantiates a new field def.
        Parameters:
        fieldName - the name of the field
        fieldType - the FieldType value
        typeName - the name of this composite type
        len - the field length
        isFixedLength - len may be non-zero and variable
        isUnsigned - Only applies to integers and decimal fields. Ignored otherwise
        sourceType - the source type
        childDefs - Child field defs. Only used for Records, Sets and Datasets. Sets and Dataset should have a single child. Null otherwise.
      • FieldDef

        public FieldDef​(String fieldName,
                        FieldType fieldType,
                        String typeName,
                        long len,
                        boolean isFixedLength,
                        boolean isUnsigned,
                        int additionalFlags,
                        HpccSrcType sourceType,
                        FieldDef[] childDefs)
        Instantiates a new field def.
        Parameters:
        fieldName - the name of the field
        fieldType - the FieldType value
        typeName - the name of this composite type
        len - the field length
        isFixedLength - len may be non-zero and variable
        isUnsigned - Only applies to integers and decimal fields. Ignored otherwise
        additionalFlags - Additional flags. Primarily used to retain layout information in HPCC records during conversion.
        sourceType - the source type
        childDefs - Child field defs. Only used for Records, Sets and Datasets. Sets and Dataset should have a single child. Null otherwise.
    • Method Detail

      • getFieldName

        public String getFieldName()
        the name of the field.
        Returns:
        the name
      • setFieldName

        public void setFieldName​(String newFieldName)
        Sets the field name.
        Parameters:
        newFieldName - the new field name
      • getFieldType

        public FieldType getFieldType()
        the type of the field using the FieldType ENUM type.
        Returns:
        the type as an enumeration value
      • getSourceType

        public HpccSrcType getSourceType()
        Data type on the HPCC cluster.
        Returns:
        type enumeration
      • setDataLen

        public void setDataLen​(long dataLen)
        Length of data or minimum length if variable.
        Parameters:
        dataLen - the new data len
      • getDataLen

        public long getDataLen()
        Length of the data or minimum length if variable.
        Returns:
        length
      • getPrecision

        public int getPrecision()
        Returns precision for decimal fields. Return 0 if this field is not a decimal
        Returns:
        precision
      • setPrecision

        public void setPrecision​(int precision)
        Sets precision for decimal fields.
        Parameters:
        precision - the new precision
      • getScale

        public int getScale()
        Returns scale for decimal fields. Return 0 if this field is not a decimal
        Returns:
        scale
      • setScale

        public void setScale​(int scale)
        Sets scale for decimal fields.
        Parameters:
        scale - the new scale
      • isFixed

        public boolean isFixed()
        Fixed or variable length.
        Returns:
        true when fixed length
      • isUnsigned

        public boolean isUnsigned()
        Is the underlying value type unsigned?.
        Returns:
        true when unsigned
      • isBiased

        public boolean isBiased()
        Is the underlying value biased?
        Returns:
        true when biased
      • getAdditionalFlags

        public int getAdditionalFlags()
        Get the additional flags for this fields.
        Returns:
        the additional flags
      • setAdditionalFlags

        public void setAdditionalFlags​(int flags)
        Set the additional flags for this fields.
        Parameters:
        flags - the new additional flags
      • getNumDefs

        public int getNumDefs()
        Number of field definitions. Zero if this is not a record
        Returns:
        number
      • getDef

        public FieldDef getDef​(int ndx)
        Get the FieldDef at position. Will throw an array out of bounds exception.
        Parameters:
        ndx - index position
        Returns:
        the FieldDef object
      • setDefs

        public void setDefs​(FieldDef[] childDefs)
        Set the Child FieldDefs.
        Parameters:
        childDefs - the new defs
      • getDefIndexWithFieldName

        public int getDefIndexWithFieldName​(String fieldName)
      • getDefinitions

        public Iterator<FieldDef> getDefinitions()
        An iterator to walk though the type definitions that compose this type.
        Returns:
        an iterator returning FieldDef objects