org.apache.ignite.internal.binary

## Class BinaryFieldImpl

- java.lang.Object
- - org.apache.ignite.internal.binary.BinaryFieldImpl

All Implemented Interfaces:
  BinaryField, BinaryFieldEx

    public class BinaryFieldImpl
    extends Object
    implements BinaryFieldEx

Implementation of binary field descriptor.

### Constructor Summary

Constructors
Constructor and Description
`BinaryFieldImpl(BinaryContext ctx, int typeId, BinarySchemaRegistry schemas, String fieldName, int fieldId)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `exists(BinaryObject obj)` Check whether field exists in the object.
`int` `fieldId()`
`int` `fieldOrder(BinaryObjectExImpl obj)` Get relative field offset.
`String` `name()` Get field's name.
`<F> F` `readField(ByteBuffer buf)` Reads field value from the given byte buffer.
`String` `toString()`
`int` `typeId()`
`<T> T` `value(BinaryObject obj)` Get field's value from the given object.
`boolean` `writeField(BinaryObject obj, ByteBuffer buf)` Writes field value to the given byte buffer.

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

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

### Constructor Detail

#### BinaryFieldImpl

    public BinaryFieldImpl(BinaryContext ctx,
                           int typeId,
                           BinarySchemaRegistry schemas,
                           String fieldName,
                           int fieldId)

Constructor.

Parameters:
  `ctx` - Binary context.
  `typeId` - Type ID.
  `schemas` - Schemas.
  `fieldName` - Field name.
  `fieldId` - Field ID.

### Method Detail

#### name

    public String name()

Get field's name.

Specified by:
  `name` in interface `BinaryField`
Returns:
  Name.

#### fieldId

    public int fieldId()

Returns:
  Field ID.

#### exists

    public boolean exists(BinaryObject obj)

Check whether field exists in the object.

Specified by:
  `exists` in interface `BinaryField`
Parameters:
  `obj` - Object.
Returns:
  `True` if exists.

#### value

    public <T> T value(BinaryObject obj)

Get field's value from the given object.

Specified by:
  `value` in interface `BinaryField`
Parameters:
  `obj` - Object.
Returns:
  Value.

#### typeId

    public int typeId()

Specified by:
  `typeId` in interface `BinaryFieldEx`
Returns:
  Type ID this field relates to.

#### writeField

    public boolean writeField(BinaryObject obj,
                              ByteBuffer buf)

Writes field value to the given byte buffer.

Specified by:
  `writeField` in interface `BinaryFieldEx`
Parameters:
  `obj` - Object from which the field should be extracted.
  `buf` - Buffer to write the field value to.
Returns:
  `True` if the value was successfully written, `false` if there is not enough space for the field in the buffer.

#### readField

    public <F> F readField(ByteBuffer buf)

Reads field value from the given byte buffer.

Specified by:
  `readField` in interface `BinaryFieldEx`
Parameters:
  `buf` - Buffer to read value from.
Returns:
  Field value.

#### fieldOrder

    public int fieldOrder(BinaryObjectExImpl obj)

Get relative field offset.

Parameters:
  `obj` - Object.
Returns:
  Field offset.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.5.0
Release Date | : May 23 2018