Package org.apache.ignite.internal.client.thin

## Class ClientBinary

- java.lang.Object
- - org.apache.ignite.internal.client.thin.ClientBinary

All Implemented Interfaces:
  `IgniteBinary`

    public class ClientBinary
    extends Object
    implements IgniteBinary

Thin client implementation of `IgniteBinary`.

### Method Summary

All Methods Instance Methods Concrete Methods
`BinaryContext` `binaryContext()`
`BinaryObject` `buildEnum​(String typeName, int ord)` Create enum object using value.
`BinaryObject` `buildEnum​(String typeName, String name)` Create enum object using name.
`BinaryObjectBuilder` `builder​(String typeName)` Creates new binary builder.
`BinaryObjectBuilder` `builder​(BinaryObject binaryObj)` Creates binary builder initialized by existing binary object.
`BinaryType` `registerClass​(Class<?> cls)` Register binary type for specified class.
`BinaryType` `registerEnum​(String typeName, Map<String,​Integer> vals)` Register enum type.
`<T> T` `toBinary​(Object obj)` Converts provided object to instance of `BinaryObject`.
`BinaryType` `type​(int typeId)` Gets metadata for provided type ID.
`BinaryType` `type​(Class<?> cls)` Gets metadata for provided class.
`BinaryType` `type​(String typeName)` Gets metadata for provided class name.
`int` `typeId​(String typeName)` Gets type ID for given type name.
`Collection<BinaryType>` `types()` Gets metadata for all known types.

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

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

### Method Detail

#### typeId

    public int typeId​(String typeName)

Gets type ID for given type name. If no user defined `BinaryIdMapper` is configured via `BinaryConfiguration`, then system mapper will be used.

Specified by:
  `typeId` in interface `IgniteBinary`
Parameters:
  `typeName` - Type name.
Returns:
  Type ID which a type would have had if it has been registered in Ignite.

#### toBinary

    public <T> T toBinary​(Object obj)

Converts provided object to instance of `BinaryObject`.

Specified by:
  `toBinary` in interface `IgniteBinary`
Type Parameters:
  `T` - Type of the binary object.
Parameters:
  `obj` - Object to convert.
Returns:
  Converted object or `null` if obj is null.

#### builder

    public BinaryObjectBuilder builder​(String typeName)

Creates new binary builder.

Specified by:
  `builder` in interface `IgniteBinary`
Parameters:
  `typeName` - Type name.
Returns:
  Newly binary builder.

#### builder

    public BinaryObjectBuilder builder​(BinaryObject binaryObj)

Creates binary builder initialized by existing binary object.

Specified by:
  `builder` in interface `IgniteBinary`
Parameters:
  `binaryObj` - Binary object to initialize builder.
Returns:
  Binary builder.

#### type

    public BinaryType type​(Class<?> cls)
                    throws BinaryObjectException

Gets metadata for provided class.

Specified by:
  `type` in interface `IgniteBinary`
Parameters:
  `cls` - Class.
Returns:
  Metadata.
Throws:
  `BinaryObjectException` - In case of error.

#### type

    public BinaryType type​(String typeName)

Gets metadata for provided class name.

Specified by:
  `type` in interface `IgniteBinary`
Parameters:
  `typeName` - Type name.
Returns:
  Metadata.

#### type

    public BinaryType type​(int typeId)

Gets metadata for provided type ID.

Specified by:
  `type` in interface `IgniteBinary`
Parameters:
  `typeId` - Type ID.
Returns:
  Metadata.

#### types

    public Collection<BinaryType> types()

Gets metadata for all known types.

Specified by:
  `types` in interface `IgniteBinary`
Returns:
  Metadata.

#### buildEnum

    public BinaryObject buildEnum​(String typeName,
                                  int ord)

Create enum object using value.

Specified by:
  `buildEnum` in interface `IgniteBinary`
Parameters:
  `typeName` - Type name.
  `ord` - Ordinal.
Returns:
  Enum object.

#### buildEnum

    public BinaryObject buildEnum​(String typeName,
                                  String name)

Create enum object using name.

Specified by:
  `buildEnum` in interface `IgniteBinary`
Parameters:
  `typeName` - Type name.
  `name` - Name.
Returns:
  Enum object.

#### registerEnum

    public BinaryType registerEnum​(String typeName,
                                   Map<String,​Integer> vals)

Register enum type.

Specified by:
  `registerEnum` in interface `IgniteBinary`
Parameters:
  `typeName` - Type name.
  `vals` - Mapping of enum constant names to ordinals.
Returns:
  Binary type for registered enum.

#### registerClass

    public BinaryType registerClass​(Class<?> cls)
                             throws BinaryObjectException

Register binary type for specified class.

Specified by:
  `registerClass` in interface `IgniteBinary`
Parameters:
  `cls` - Class.
Returns:
  Metadata.
Throws:
  `BinaryObjectException` - In case of error.

#### binaryContext

    public BinaryContext binaryContext()

Returns:
  Binary context.