Package org.hpccsystems.commons.ecl
Class FieldDef
- java.lang.Object
-
- org.hpccsystems.commons.ecl.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 Summary
Constructors Constructor Description FieldDef(String fieldName, FieldType fieldType, String typeName, long len, boolean isFixedLength, boolean isUnsigned, int additionalFlags, HpccSrcType sourceType, FieldDef[] childDefs)
Instantiates a new field def.FieldDef(String fieldName, FieldType fieldType, String typeName, long len, boolean isFixedLength, boolean isUnsigned, HpccSrcType sourceType, FieldDef[] childDefs)
Instantiates a new field def.FieldDef(FieldDef rhs)
Instantiates a new field def.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAdditionalFlags()
Get the additional flags for this fields.long
getDataLen()
Length of the data or minimum length if variable.FieldDef
getDef(int ndx)
Get the FieldDef at position.int
getDefIndexWithFieldName(String fieldName)
Iterator<FieldDef>
getDefinitions()
An iterator to walk though the type definitions that compose this type.String
getFieldName()
the name of the field.FieldType
getFieldType()
the type of the field using the FieldType ENUM type.int
getNumDefs()
Number of field definitions.int
getPrecision()
Returns precision for decimal fields.int
getScale()
Returns scale for decimal fields.HpccSrcType
getSourceType()
Data type on the HPCC cluster.boolean
isBiased()
Is the underlying value biased?boolean
isFixed()
Fixed or variable length.boolean
isUnsigned()
Is the underlying value type unsigned?.void
setAdditionalFlags(int flags)
Set the additional flags for this fields.void
setDataLen(long dataLen)
Length of data or minimum length if variable.void
setDefs(FieldDef[] childDefs)
Set the Child FieldDefs.void
setFieldName(String newFieldName)
Sets the field name.void
setPrecision(int precision)
Sets precision for decimal fields.void
setScale(int scale)
Sets scale for decimal fields.String
toString()
-
-
-
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 fieldfieldType
- the FieldType valuetypeName
- the name of this composite typelen
- the field lengthisFixedLength
- len may be non-zero and variableisUnsigned
- Only applies to integers and decimal fields. Ignored otherwisesourceType
- the source typechildDefs
- 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 fieldfieldType
- the FieldType valuetypeName
- the name of this composite typelen
- the field lengthisFixedLength
- len may be non-zero and variableisUnsigned
- Only applies to integers and decimal fields. Ignored otherwiseadditionalFlags
- Additional flags. Primarily used to retain layout information in HPCC records during conversion.sourceType
- the source typechildDefs
- 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
-
-