org.apache.ignite.internal.binary

## Class BinaryContext

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

    public class BinaryContext
    extends Object

Binary context.

### Constructor Summary

Constructors
Constructor and Description
`BinaryContext()` For `Externalizable`.
`BinaryContext(BinaryMetadataHandler metaHnd, IgniteConfiguration igniteCfg, IgniteLogger log)`

### Method Summary

Methods
`String` `affinityKeyFieldName(int typeId)`
`byte` `collectionType(Class<? extends Collection> cls)`
`IgniteConfiguration` `configuration()`
`void` `configure(BinaryMarshaller marsh, IgniteConfiguration cfg)`
`BinaryFieldImpl` `createField(int typeId, String fieldName)` Create binary field.
`BinaryClassDescriptor` `descriptorForClass(Class<?> cls, boolean deserialize)`
`BinaryClassDescriptor` `descriptorForTypeId(boolean userType, int typeId, ClassLoader ldr, boolean deserialize)`
`int` `fieldId(int typeId, String fieldName)`
`boolean` `isCompactFooter()`
`IgniteLogger` `log()`
`byte` `mapType(Class<? extends Map> cls)`
`BinaryMarshaller` `marshaller()`
`BinaryType` `metadata(int typeId)`
`boolean` `mustDeserialize(Class cls)` Check whether class must be deserialized anyway.
`void` `onUndeploy(ClassLoader ldr)` Undeployment callback invoked when class loader is being undeployed.
`BinaryClassDescriptor` `registerPredefinedType(Class<?> cls, int id)`
`BinaryClassDescriptor` `registerPredefinedType(Class<?> cls, int id, String affFieldName)`
`void` `registerUserType(String clsName, BinaryIdMapper idMapper, BinarySerializer serializer, String affKeyFieldName, boolean isEnum)`
`BinarySchemaRegistry` `schemaRegistry(int typeId)` Get schema registry for type ID.
`int` `typeId(String typeName)`
`static String` `typeName(String clsName)`
`void` `updateMetadata(int typeId, BinaryMetadata meta)`
`BinaryIdMapper` `userTypeIdMapper(int typeId)`

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

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

### Constructor Detail

#### BinaryContext

    public BinaryContext()

For `Externalizable`.

#### BinaryContext

    public BinaryContext(BinaryMetadataHandler metaHnd,
                 IgniteConfiguration igniteCfg,
                 IgniteLogger log)

Parameters:
  `metaHnd` - Meta data handler.
  `igniteCfg` - Ignite configuration.
  `log` - Logger.

### Method Detail

#### log

    public IgniteLogger log()

Returns:
  Logger.

#### marshaller

    public BinaryMarshaller marshaller()

Returns:
  Marshaller.

#### mustDeserialize

    public boolean mustDeserialize(Class cls)

Check whether class must be deserialized anyway.

Parameters:
  `cls` - Class.
Returns:
  `True` if must be deserialized.

#### configuration

    public IgniteConfiguration configuration()

Returns:
  Ignite configuration.

#### configure

    public void configure(BinaryMarshaller marsh,
                 IgniteConfiguration cfg)
                   throws BinaryObjectException

Parameters:
  `marsh` - Binary marshaller.
  `cfg` - Configuration.
Throws:
  `BinaryObjectException` - In case of error.

#### descriptorForClass

    public BinaryClassDescriptor descriptorForClass(Class<?> cls,
                                           boolean deserialize)
                                             throws BinaryObjectException

Parameters:
  `cls` - Class.
Returns:
  Class descriptor.
Throws:
  `BinaryObjectException` - In case of error.

#### descriptorForTypeId

    public BinaryClassDescriptor descriptorForTypeId(boolean userType,
                                            int typeId,
                                            ClassLoader ldr,
                                            boolean deserialize)

Parameters:
  `userType` - User type or not.
  `typeId` - Type ID.
  `ldr` - Class loader.
Returns:
  Class descriptor.

#### collectionType

    public byte collectionType(Class<? extends Collection> cls)

Parameters:
  `cls` - Collection class.
Returns:
  Collection type ID.

#### mapType

    public byte mapType(Class<? extends Map> cls)

Parameters:
  `cls` - Map class.
Returns:
  Map type ID.

#### typeId

    public int typeId(String typeName)

Parameters:
  `typeName` - Type name.
Returns:
  Type ID.

#### fieldId

    public int fieldId(int typeId,
              String fieldName)

Parameters:
  `typeId` - Type ID.
  `fieldName` - Field name.
Returns:
  Field ID.

#### userTypeIdMapper

    public BinaryIdMapper userTypeIdMapper(int typeId)

Parameters:
  `typeId` - Type ID.
Returns:
  Instance of ID mapper.

#### registerPredefinedType

    public BinaryClassDescriptor registerPredefinedType(Class<?> cls,
                                               int id)

Parameters:
  `cls` - Class.
  `id` - Type ID.
Returns:
  GridBinaryClassDescriptor.

#### registerPredefinedType

    public BinaryClassDescriptor registerPredefinedType(Class<?> cls,
                                               int id,
                                               String affFieldName)

Parameters:
  `cls` - Class.
  `id` - Type ID.
Returns:
  GridBinaryClassDescriptor.

#### registerUserType

    public void registerUserType(String clsName,
                        BinaryIdMapper idMapper,
                        @Nullable
                        BinarySerializer serializer,
                        @Nullable
                        String affKeyFieldName,
                        boolean isEnum)
                          throws BinaryObjectException

Parameters:
  `clsName` - Class name.
  `idMapper` - ID mapper.
  `serializer` - Serializer.
  `affKeyFieldName` - Affinity key field name.
  `isEnum` - If enum.
Throws:
  `BinaryObjectException` - In case of error.

#### createField

    public BinaryFieldImpl createField(int typeId,
                              String fieldName)

Create binary field.

Parameters:
  `typeId` - Type ID.
  `fieldName` - Field name.
Returns:
  Binary field.

#### metadata

    @Nullable
    public BinaryType metadata(int typeId)
                        throws BinaryObjectException

Parameters:
  `typeId` - Type ID.
Returns:
  Meta data.
Throws:
  `BinaryObjectException` - In case of error.

#### affinityKeyFieldName

    public String affinityKeyFieldName(int typeId)

Parameters:
  `typeId` - Type ID.
Returns:
  Affinity key field name.

#### updateMetadata

    public void updateMetadata(int typeId,
                      BinaryMetadata meta)
                        throws BinaryObjectException

Parameters:
  `typeId` - Type ID.
  `meta` - Meta data.
Throws:
  `BinaryObjectException` - In case of error.

#### isCompactFooter

    public boolean isCompactFooter()

Returns:
  Whether field IDs should be skipped in footer or not.

#### schemaRegistry

    public BinarySchemaRegistry schemaRegistry(int typeId)

Get schema registry for type ID.

Parameters:
  `typeId` - Type ID.
Returns:
  Schema registry for type ID.

#### typeName

    public static String typeName(String clsName)

Parameters:
  `clsName` - Class name.
Returns:
  Type name.

#### onUndeploy

    public void onUndeploy(ClassLoader ldr)

Undeployment callback invoked when class loader is being undeployed. Some marshallers may want to clean their internal state that uses the undeployed class loader somehow.

Parameters:
  `ldr` - Class loader being undeployed.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0.final
Release Date | : December 29 2015