org.firebirdsql.gds.ng.fields

## Class FieldDescriptor

- java.lang.Object
- - org.firebirdsql.gds.ng.fields.FieldDescriptor

-     public final class FieldDescriptor
      extends java.lang.Object

  The class `FieldDescriptor` contains the column metadata of the XSQLVAR server data structure used to describe one column for input or output.

  FieldDescriptor is an immutable type, the value of a field is maintained separately in an instance of `FieldValue`.

  Version:
    3.0
  Author:
    Mark Rotteveel

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldDescriptor(int position, DatatypeCoder datatypeCoder, int type, int subType, int scale, int length, java.lang.String fieldName, java.lang.String tableAlias, java.lang.String originalName, java.lang.String originalTableName, java.lang.String ownerName)` Constructor for metadata FieldDescriptor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FieldValue` | `createDefaultFieldValue()` Creates a default, uninitialized `FieldValue`
    `boolean` | `equals(java.lang.Object obj)`
    `DatatypeCoder` | `getDatatypeCoder()`
    `IEncodingFactory` | `getEncodingFactory()`
    `java.lang.String` | `getFieldName()`
    `int` | `getLength()`
    `java.lang.String` | `getOriginalName()`
    `java.lang.String` | `getOriginalTableName()`
    `java.lang.String` | `getOwnerName()`
    `int` | `getPosition()`
    `int` | `getScale()`
    `int` | `getSubType()`
    `java.lang.String` | `getTableAlias()`
    `int` | `getType()`
    `int` | `hashCode()`
    `boolean` | `isFbType(int fbType)` Check if the type of this field is the specified Firebird data type.
    `boolean` | `isNullable()`
    `boolean` | `isVarying()`
    `java.lang.String` | `toString()`
    `boolean` | `typeEquals(FieldDescriptor other)` Limited equals that only checks if the data type in the provided field descriptor is the same as this descriptor.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FieldDescriptor

          public FieldDescriptor(int position,
                                 DatatypeCoder datatypeCoder,
                                 int type,
                                 int subType,
                                 int scale,
                                 int length,
                                 java.lang.String fieldName,
                                 java.lang.String tableAlias,
                                 java.lang.String originalName,
                                 java.lang.String originalTableName,
                                 java.lang.String ownerName)

      Constructor for metadata FieldDescriptor.
      Parameters:
        `position` - Position of this field (0-based), or `-1` if position is not known (eg for test code)
        `datatypeCoder` - Instance of DatatypeCoder to use when decoding column data
        `type` - Column SQL type
        `subType` - Column subtype
        `scale` - Column scale
        `length` - Column defined length
        `fieldName` - Column alias name
        `tableAlias` - Column table alias
        `originalName` - Column original name
        `originalTableName` - Column original table
        `ownerName` - Owner of the column/table

  - ### Method Detail

    - #### getPosition

          public int getPosition()

      Returns:
        The 0-based position of this field (or `-1`)

    - #### getDatatypeCoder

          public DatatypeCoder getDatatypeCoder()

      Returns:
        The `DatatypeCoder` to use when decoding field data.

    - #### getEncodingFactory

          public IEncodingFactory getEncodingFactory()

      Returns:
        The `IEncodingFactory` for the associated connection.

    - #### getType

          public int getType()

      Returns:
        The Firebird type of this field

    - #### getSubType

          public int getSubType()

      Returns:
        The Firebird subtype of this field

    - #### getScale

          public int getScale()

      Returns:
        The scale of this field

    - #### getLength

          public int getLength()

      Returns:
        The declared (maximum) length of this field

    - #### getFieldName

          public java.lang.String getFieldName()

      Returns:
        The (aliased) field name

    - #### getTableAlias

          public java.lang.String getTableAlias()

      Returns:
        The (aliased) table name

    - #### getOriginalName

          public java.lang.String getOriginalName()

      Returns:
        The original name of the field (eg the column name in the table)

    - #### getOriginalTableName

          public java.lang.String getOriginalTableName()

      Returns:
        The original table name

    - #### getOwnerName

          public java.lang.String getOwnerName()

      Returns:
        The owner

    - #### isVarying

          public boolean isVarying()

      Returns:
        `true` if the type is variable length (ie `ISCConstants.SQL_VARYING`).

    - #### isFbType

          public boolean isFbType(int fbType)

      Check if the type of this field is the specified Firebird data type.

      This method assumes the not-nullable data type is passed, on checking the nullable bit of `getType()` is set to `0`.

      Parameters:
        `fbType` - One of the `SQL_` data type identifier values
      Returns:
        `true` if the type is the same as the type of this field

    - #### isNullable

          public boolean isNullable()

      Returns:
        `true` if this field is nullable.

    - #### createDefaultFieldValue

          public FieldValue createDefaultFieldValue()

      Creates a default, uninitialized `FieldValue`
      Returns:
        A new `FieldValue`

    - #### typeEquals

          public boolean typeEquals(FieldDescriptor other)

      Limited equals that only checks if the data type in the provided field descriptor is the same as this descriptor.

      The fields checked are:

      - type
      - subType
      - scale
      - length
      Parameters:
        `other` - Field descriptor to check
      Returns:
        `true` when `other` is not null and has the same type definition as this instance, `false` otherwise.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.