Module org.firebirdsql.jaybird
Package org.firebirdsql.jdbc.field

# Class FBField

java.lang.Object
org.firebirdsql.jdbc.field.FBField

Direct Known Subclasses:
  `FBLongVarCharField`

@NullUnmarked public abstract class FBField extends Object
Base class for fields (for use by prepared statement and result set to represent columns and parameters).

Author:
  Roman Rokytskyy, Mark Rotteveel

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final @NonNull FieldDescriptor`
`fieldDescriptor`
`protected GDSHelper`
`gdsHelper`
`protected int`
`requiredType`

## Method Summary

Modifier and Type
Method
Description
`static FBField`
`createField(FieldDescriptor fieldDescriptor, FieldDataProvider dataProvider, @Nullable GDSHelper gdsHelper, boolean cached)`
This is a factory method that creates appropriate instance of the `FBField` class according to the SQL datatype.
`String`
`getAlias()`
Returns the alias of the column as declared in XSQLVAR.
`Array`
`getArray()`
`BigDecimal`
`getBigDecimal()`
`final BigDecimal`
`getBigDecimal(int scale)`
`BigInteger`
`getBigInteger()`
`InputStream`
`getBinaryStream()`
`Blob`
`getBlob()`
`boolean`
`getBoolean()`
`byte`
`getByte()`
`byte[]`
`getBytes()`
`Reader`
`getCharacterStream()`
`Clob`
`getClob()`
`protected final @NonNull DatatypeCoder`
`getDatatypeCoder()`
`Date`
`getDate()`
`Date`
`getDate(Calendar cal)`
`Decimal<?>`
`getDecimal()`
Returns the value as a Decimal type.
`final <D extends Decimal<D>>
D`
`getDecimal(@NonNull Class<D> targetType)`
`double`
`getDouble()`
`protected final byte @Nullable []`
`getFieldData()`
`float`
`getFloat()`
`int`
`getInt()`
`long`
`getLong()`
`String`
`getName()`
Returns the name of the column as declared in the XSQLVAR.
`Object`
`getObject()`
`<T> T`
`getObject(@NonNull Class<T> type)`
`Object`
`getObject(Map<String,Class<?>> map)`
`Ref`
`getRef()`
`String`
`getRelationName()`
Returns the relation to which belongs column as declared in XSQLVAR.
`RowId`
`getRowId()`
`short`
`getShort()`
`String`
`getString()`
`Time`
`getTime()`
`Time`
`getTime(Calendar cal)`
`Timestamp`
`getTimestamp()`
`Timestamp`
`getTimestamp(Calendar cal)`
`final boolean`
`isNull()`
`void`
`setBigDecimal(BigDecimal value)`
`void`
`setBigInteger(BigInteger value)`
`final void`
`setBinaryStream(InputStream in)`
`final void`
`setBinaryStream(InputStream in, int length)`
`final void`
`setBinaryStream(InputStream in, long length)`
`protected void`
`setBinaryStreamInternal(InputStream in, long length)`
`void`
`setBlob(Blob blob)`
`void`
`setBlob(FBBlob blob)`
`void`
`setBoolean(boolean value)`
`void`
`setByte(byte value)`
`void`
`setBytes(byte[] value)`
`final void`
`setCharacterStream(Reader in)`
`final void`
`setCharacterStream(Reader in, int length)`
`final void`
`setCharacterStream(Reader in, long length)`
`protected void`
`setCharacterStreamInternal(Reader in, long length)`
`void`
`setClob(Clob clob)`
`void`
`setClob(FBClob clob)`
`final void`
`setConnection(GDSHelper gdsHelper)`
`void`
`setDate(Date value)`
`void`
`setDate(Date value, Calendar cal)`
`void`
`setDecimal(Decimal<?> decimal)`
Sets the value as a Decimal type.
`void`
`setDouble(double value)`
`protected final void`
`setFieldData(byte @Nullable [] data)`
`void`
`setFloat(float value)`
`void`
`setInteger(int value)`
`void`
`setLong(long value)`
`void`
`setNull()`
`void`
`setObject(Object value)`
`void`
`setObject(Object value, int scaleOrLength)`
`void`
`setRequiredType(int requiredType)`
Set the required type for `getObject()` conversion.
`void`
`setRowId(RowId rowId)`
`void`
`setShort(short value)`
`void`
`setString(String value)`
`void`
`setTime(Time value)`
`void`
`setTime(Time value, Calendar cal)`
`void`
`setTimestamp(Timestamp value)`
`void`
`setTimestamp(Timestamp value, Calendar cal)`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### fieldDescriptor

protected final @NonNull FieldDescriptor fieldDescriptor

### gdsHelper

protected GDSHelper gdsHelper

### requiredType

protected int requiredType

## Method Details

### getFieldData

protected final byte @Nullable [] getFieldData()

### setFieldData

protected final void setFieldData(byte @Nullable [] data)

### getDatatypeCoder

protected final @NonNull DatatypeCoder getDatatypeCoder()

### isNull

public final boolean isNull() throws SQLException

Returns:
  `true` if the corresponding field is `null`, otherwise `false`
Throws:
  `SQLException`

### setNull

public void setNull()

### setConnection

public final void setConnection(GDSHelper gdsHelper)

### setRequiredType

public void setRequiredType(int requiredType)
Set the required type for `getObject()` conversion.

Parameters:
  `requiredType` - required type, one of the `Types` constants.

### createField

@NullMarked public static FBField createField(FieldDescriptor fieldDescriptor, FieldDataProvider dataProvider, @Nullable GDSHelper gdsHelper, boolean cached) throws SQLException
This is a factory method that creates appropriate instance of the `FBField` class according to the SQL datatype. This instance knows how to perform all necessary type conversions.

Throws:
  `SQLException`

### getName

public String getName()
Returns the name of the column as declared in the XSQLVAR.

### getAlias

public String getAlias()
Returns the alias of the column as declared in XSQLVAR.

### getRelationName

public String getRelationName()
Returns the relation to which belongs column as declared in XSQLVAR.

### getByte

public byte getByte() throws SQLException

Throws:
  `SQLException`

### getShort

public short getShort() throws SQLException

Throws:
  `SQLException`

### getInt

public int getInt() throws SQLException

Throws:
  `SQLException`

### getLong

public long getLong() throws SQLException

Throws:
  `SQLException`

### getFloat

public float getFloat() throws SQLException

Throws:
  `SQLException`

### getDouble

public double getDouble() throws SQLException

Throws:
  `SQLException`

### getBigDecimal

public BigDecimal getBigDecimal() throws SQLException

Throws:
  `SQLException`

### getBigDecimal

public final BigDecimal getBigDecimal(int scale) throws SQLException

Throws:
  `SQLException`

### getBoolean

public boolean getBoolean() throws SQLException

Throws:
  `SQLException`

### getString

public String getString() throws SQLException

Throws:
  `SQLException`

### getObject

public Object getObject() throws SQLException

Throws:
  `SQLException`

### getObject

public Object getObject(Map<String,Class<?>> map) throws SQLException

Throws:
  `SQLException`

### getObject

public <T> T getObject(@NonNull Class<T> type) throws SQLException

Throws:
  `SQLException`

### getBinaryStream

public InputStream getBinaryStream() throws SQLException

Throws:
  `SQLException`

### getCharacterStream

public Reader getCharacterStream() throws SQLException

Throws:
  `SQLException`

### getBytes

public byte[] getBytes() throws SQLException

Throws:
  `SQLException`

### getBlob

public Blob getBlob() throws SQLException

Throws:
  `SQLException`

### getDate

public Date getDate() throws SQLException

Throws:
  `SQLException`

### getDate

public Date getDate(Calendar cal) throws SQLException

Throws:
  `SQLException`

### getTime

public Time getTime() throws SQLException

Throws:
  `SQLException`

### getTime

public Time getTime(Calendar cal) throws SQLException

Throws:
  `SQLException`

### getTimestamp

public Timestamp getTimestamp() throws SQLException

Throws:
  `SQLException`

### getTimestamp

public Timestamp getTimestamp(Calendar cal) throws SQLException

Throws:
  `SQLException`

### getRef

public Ref getRef() throws SQLException

Throws:
  `SQLException`

### getClob

public Clob getClob() throws SQLException

Throws:
  `SQLException`

### getArray

public Array getArray() throws SQLException

Throws:
  `SQLException`

### getBigInteger

public BigInteger getBigInteger() throws SQLException

Throws:
  `SQLException`

### getRowId

public RowId getRowId() throws SQLException

Throws:
  `SQLException`

### setByte

public void setByte(byte value) throws SQLException

Throws:
  `SQLException`

### setShort

public void setShort(short value) throws SQLException

Throws:
  `SQLException`

### setInteger

public void setInteger(int value) throws SQLException

Throws:
  `SQLException`

### setLong

public void setLong(long value) throws SQLException

Throws:
  `SQLException`

### setFloat

public void setFloat(float value) throws SQLException

Throws:
  `SQLException`

### setDouble

public void setDouble(double value) throws SQLException

Throws:
  `SQLException`

### setBigDecimal

public void setBigDecimal(BigDecimal value) throws SQLException

Throws:
  `SQLException`

### setBoolean

public void setBoolean(boolean value) throws SQLException

Throws:
  `SQLException`

### setString

public void setString(String value) throws SQLException

Throws:
  `SQLException`

### setBigInteger

public void setBigInteger(BigInteger value) throws SQLException

Throws:
  `SQLException`

### setObject

public void setObject(Object value) throws SQLException

Throws:
  `SQLException`

### setObject

public void setObject(Object value, int scaleOrLength) throws SQLException

Throws:
  `SQLException`

### setBinaryStreamInternal

protected void setBinaryStreamInternal(InputStream in, long length) throws SQLException

Throws:
  `SQLException`

### setBinaryStream

public final void setBinaryStream(InputStream in, long length) throws SQLException

Throws:
  `SQLException`

### setBinaryStream

public final void setBinaryStream(InputStream in) throws SQLException

Throws:
  `SQLException`

### setBinaryStream

public final void setBinaryStream(InputStream in, int length) throws SQLException

Throws:
  `SQLException`

### setCharacterStreamInternal

protected void setCharacterStreamInternal(Reader in, long length) throws SQLException

Throws:
  `SQLException`

### setCharacterStream

public final void setCharacterStream(Reader in, long length) throws SQLException

Throws:
  `SQLException`

### setCharacterStream

public final void setCharacterStream(Reader in) throws SQLException

Throws:
  `SQLException`

### setCharacterStream

public final void setCharacterStream(Reader in, int length) throws SQLException

Throws:
  `SQLException`

### setBytes

public void setBytes(byte[] value) throws SQLException

Throws:
  `SQLException`

### setDate

public void setDate(Date value, Calendar cal) throws SQLException

Throws:
  `SQLException`

### setDate

public void setDate(Date value) throws SQLException

Throws:
  `SQLException`

### setTime

public void setTime(Time value, Calendar cal) throws SQLException

Throws:
  `SQLException`

### setTime

public void setTime(Time value) throws SQLException

Throws:
  `SQLException`

### setTimestamp

public void setTimestamp(Timestamp value, Calendar cal) throws SQLException

Throws:
  `SQLException`

### setTimestamp

public void setTimestamp(Timestamp value) throws SQLException

Throws:
  `SQLException`

### setBlob

public void setBlob(FBBlob blob) throws SQLException

Throws:
  `SQLException`

### setBlob

public void setBlob(Blob blob) throws SQLException

Throws:
  `SQLException`

### setClob

public void setClob(FBClob clob) throws SQLException

Throws:
  `SQLException`

### setClob

public void setClob(Clob clob) throws SQLException

Throws:
  `SQLException`

### setRowId

public void setRowId(RowId rowId) throws SQLException

Throws:
  `SQLException`

### getDecimal

public Decimal<?> getDecimal() throws SQLException
Returns the value as a Decimal type.

The default for this method is implemented in terms of `getBigDecimal()`, and returning a `Decimal128`. Implementations may return a `Decimal64` (or even `Decimal32`).

Returns:
  The value as decimal
Throws:
  `SQLException` - For database access errors, or values that cannot be converted.

### getDecimal

public final <D extends Decimal<D>> D getDecimal(@NonNull Class<D> targetType) throws SQLException

Throws:
  `SQLException`

### setDecimal

public void setDecimal(Decimal<?> decimal) throws SQLException
Sets the value as a Decimal type.

The default for this method is implemented in terms of `setBigDecimal(BigDecimal)`.

Parameters:
  `decimal` - Value to set
Throws:
  `SQLException`