org.apache.ignite.internal.portable

## Class PortableContext

- java.lang.Object
- - org.apache.ignite.internal.portable.PortableContext

All Implemented Interfaces:
  Externalizable, Serializable

    public class PortableContext
    extends Object
    implements Externalizable

Portable context.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`PortableContext()` For `Externalizable`.
`PortableContext(PortableMetaDataHandler metaHnd, String gridName)`

### Method Summary

Methods
`byte` `collectionType(Class<? extends Collection> cls)`
`void` `configure(PortableMarshaller marsh)`
`PortableClassDescriptor` `descriptorForClass(Class<?> cls)`
`PortableClassDescriptor` `descriptorForTypeId(boolean userType, int typeId, ClassLoader ldr)`
`int` `fieldId(int typeId, String fieldName)`
`PortableIdMapper` `idMapper(int typeId)`
`boolean` `isConvertString()`
`boolean` `isMetaDataEnabled(int typeId)`
`boolean` `isUseTimestamp()`
`boolean` `isUseTimestamp(int typeId)`
`byte` `mapType(Class<? extends Map> cls)`
`PortableMetadata` `metaData(int typeId)`
`void` `readExternal(ObjectInput in)`
`protected Object` `readResolve()`
`PortableClassDescriptor` `registerPredefinedType(Class<?> cls, int id)`
`void` `registerUserType(String clsName, PortableIdMapper idMapper, PortableSerializer serializer, String affKeyFieldName, boolean useTs, boolean metaDataEnabled, boolean keepDeserialized)`
`int` `typeId(String typeName)`
`static String` `typeName(String clsName)`
`void` `updateMetaData(int typeId, PortableMetaDataImpl meta)`
`void` `updateMetaData(int typeId, String typeName, Map<String,String> fields)`
`void` `writeExternal(ObjectOutput out)`

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

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

### Constructor Detail

#### PortableContext

    public PortableContext()

For `Externalizable`.

#### PortableContext

    public PortableContext(PortableMetaDataHandler metaHnd,
                   @Nullable
                   String gridName)

Parameters:
  `metaHnd` - Meta data handler.
  `gridName` - Grid name.

### Method Detail

#### configure

    public void configure(PortableMarshaller marsh)
                   throws PortableException

Parameters:
  `marsh` - Portable marshaller.
Throws:
  `PortableException` - In case of error.

#### descriptorForClass

    public PortableClassDescriptor descriptorForClass(Class<?> cls)
                                               throws PortableException

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

#### descriptorForTypeId

    public PortableClassDescriptor descriptorForTypeId(boolean userType,
                                              int typeId,
                                              ClassLoader ldr)

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.

#### idMapper

    public PortableIdMapper idMapper(int typeId)

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

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### readResolve

    protected Object readResolve()
                          throws ObjectStreamException

Returns:
  Portable context.
Throws:
  `ObjectStreamException` - In case of error.

#### registerPredefinedType

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

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

#### registerUserType

    public void registerUserType(String clsName,
                        PortableIdMapper idMapper,
                        @Nullable
                        PortableSerializer serializer,
                        @Nullable
                        String affKeyFieldName,
                        boolean useTs,
                        boolean metaDataEnabled,
                        boolean keepDeserialized)
                          throws PortableException

Parameters:
  `clsName` - Class name.
  `idMapper` - ID mapper.
  `serializer` - Serializer.
  `affKeyFieldName` - Affinity key field name.
  `useTs` - Use timestamp flag.
  `metaDataEnabled` - Metadata enabled flag.
  `keepDeserialized` - Keep deserialized flag.
Throws:
  `PortableException` - In case of error.

#### metaData

    @Nullable
    public PortableMetadata metaData(int typeId)
                              throws PortableException

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

#### isMetaDataEnabled

    public boolean isMetaDataEnabled(int typeId)

Parameters:
  `typeId` - Type ID.
Returns:
  Whether meta data is enabled.

#### updateMetaData

    public void updateMetaData(int typeId,
                      String typeName,
                      Map<String,String> fields)
                        throws PortableException

Parameters:
  `typeId` - Type ID.
  `typeName` - Type name.
  `fields` - Fields map.
Throws:
  `PortableException` - In case of error.

#### updateMetaData

    public void updateMetaData(int typeId,
                      PortableMetaDataImpl meta)
                        throws PortableException

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

#### isUseTimestamp

    public boolean isUseTimestamp()

Returns:
  Use timestamp flag.

#### isUseTimestamp

    public boolean isUseTimestamp(int typeId)

Parameters:
  `typeId` - Type ID.
Returns:
  If timestamp used.

#### isConvertString

    public boolean isConvertString()

Returns:
  Whether to convert string to UTF8 bytes.

#### typeName

    public static String typeName(String clsName)

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

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015