org.apache.ignite.internal.binary.builder

## Class BinaryObjectBuilderImpl

- java.lang.Object
- - org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl

All Implemented Interfaces:
  BinaryObjectBuilder

    public class BinaryObjectBuilderImpl
    extends Object
    implements BinaryObjectBuilder

### Constructor Summary

Constructors
Constructor and Description
`BinaryObjectBuilderImpl(BinaryContext ctx, int typeId, String typeName)`
`BinaryObjectBuilderImpl(BinaryContext ctx, String clsName)`
`BinaryObjectBuilderImpl(BinaryObjectImpl obj)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `affinityFieldName(String affFieldName)` Set known affinity key field name.
`BinaryObject` `build()` Builds binary object.
`<T> T` `getField(String name)` Returns value assigned to the specified field.
`BinaryObjectBuilderImpl` `removeField(String name)` Removes field from binary object.
`BinaryObjectBuilder` `setField(String name, @Nullable BinaryObjectBuilder builder)` Sets field value.
`BinaryObjectBuilder` `setField(String name, Object val0)` Sets field value.
`<T> BinaryObjectBuilder` `setField(String name, T val, Class<? super T> type)` Sets field value with value type specification.
`int` `typeId()`
`static BinaryObjectBuilderImpl` `wrap(BinaryObject obj)` Creates builder initialized by specified binary object.

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

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

### Constructor Detail

#### BinaryObjectBuilderImpl

    public BinaryObjectBuilderImpl(BinaryContext ctx,
                                   String clsName)

Parameters:
  `clsName` - Class name.
  `ctx` - Binary context.

#### BinaryObjectBuilderImpl

    public BinaryObjectBuilderImpl(BinaryContext ctx,
                                   int typeId,
                                   String typeName)

Parameters:
  `typeName` - Type name.
  `ctx` - Context.
  `typeId` - Type id.

#### BinaryObjectBuilderImpl

    public BinaryObjectBuilderImpl(BinaryObjectImpl obj)

Parameters:
  `obj` - Object to wrap.

### Method Detail

#### build

    public BinaryObject build()

Builds binary object.

Specified by:
  `build` in interface `BinaryObjectBuilder`
Returns:
  Binary object.

#### getField

    public <T> T getField(String name)

Returns value assigned to the specified field. If the value is a binary object then an instance of `BinaryObjectBuilder` will be returned, which can be modified.

Collections and maps returned from this method are modifiable.

Specified by:
  `getField` in interface `BinaryObjectBuilder`
Type Parameters:
  `T` - Type of the field value.
Parameters:
  `name` - Field name.
Returns:
  Field value.

#### setField

    public BinaryObjectBuilder setField(String name,
                                        Object val0)

Sets field value.

Specified by:
  `setField` in interface `BinaryObjectBuilder`
Parameters:
  `name` - Field name.
  `val0` - Field value (cannot be `null`).
Returns:
  `this` for chaining.
See Also:
  `BinaryObject.type()`

#### setField

    public <T> BinaryObjectBuilder setField(String name,
                                            @Nullable
                                            T val,
                                            Class<? super T> type)

Sets field value with value type specification.

Field type is needed for proper metadata update.

Specified by:
  `setField` in interface `BinaryObjectBuilder`
Type Parameters:
  `T` - Type of the field value.
Parameters:
  `name` - Field name.
  `val` - Field value.
  `type` - Field type.
Returns:
  `this` for chaining.
See Also:
  `BinaryObject.type()`

#### setField

    public BinaryObjectBuilder setField(String name,
                                        @Nullable
                                        @Nullable BinaryObjectBuilder builder)

Sets field value.

This method should be used if field is binary object.

Specified by:
  `setField` in interface `BinaryObjectBuilder`
Parameters:
  `name` - Field name.
  `builder` - Builder for object field.
Returns:
  `this` for chaining.

#### removeField

    public BinaryObjectBuilderImpl removeField(String name)

Removes field from binary object.

Specified by:
  `removeField` in interface `BinaryObjectBuilder`
Parameters:
  `name` - Field name.
Returns:
  `this` instance for chaining.

#### wrap

    public static BinaryObjectBuilderImpl wrap(BinaryObject obj)

Creates builder initialized by specified binary object.

Parameters:
  `obj` - Binary object to initialize builder.
Returns:
  New builder.

#### typeId

    public int typeId()

Returns:
  Object type id.

#### affinityFieldName

    public void affinityFieldName(String affFieldName)

Set known affinity key field name.

Parameters:
  `affFieldName` - Affinity key field name.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.14.0
Release Date | : September 29 2022