Class IgniteBinaryImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.binary.IgniteBinaryImpl
-
- All Implemented Interfaces:
IgniteBinary
public class IgniteBinaryImpl extends Object implements IgniteBinary
IgniteBinaryimplementation.
-
-
Constructor Summary
Constructors Constructor Description IgniteBinaryImpl(GridKernalContext ctx, IgniteCacheObjectProcessor proc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BinaryObjectbuildEnum(String typeName, int ord)Create enum object using value.BinaryObjectbuildEnum(String typeName, String name)Create enum object using name.BinaryObjectBuilderbuilder(String typeName)Creates new binary builder.BinaryObjectBuilderbuilder(BinaryObject binaryObj)Creates binary builder initialized by existing binary object.IgniteCacheObjectProcessorprocessor()BinaryTyperegisterClass(Class<?> cls)Register binary type for specified class.BinaryTyperegisterEnum(String typeName, Map<String,Integer> vals)Register enum type.<T> TtoBinary(@Nullable Object obj)Converts provided object to instance ofBinaryObject.@Nullable BinaryTypetype(int typeId)Gets metadata for provided type ID.@Nullable BinaryTypetype(Class<?> cls)Gets metadata for provided class.@Nullable BinaryTypetype(String typeName)Gets metadata for provided class name.inttypeId(String typeName)Gets type ID for given type name.Collection<BinaryType>types()Gets metadata for all known types.
-
-
-
Constructor Detail
-
IgniteBinaryImpl
public IgniteBinaryImpl(GridKernalContext ctx, IgniteCacheObjectProcessor proc)
- Parameters:
ctx- Context.
-
-
Method Detail
-
typeId
public int typeId(String typeName)
Gets type ID for given type name. If no user definedBinaryIdMapperis configured viaBinaryConfiguration, then system mapper will be used.- Specified by:
typeIdin interfaceIgniteBinary- 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(@Nullable @Nullable Object obj) throws BinaryObjectExceptionConverts provided object to instance ofBinaryObject.- Specified by:
toBinaryin interfaceIgniteBinary- Type Parameters:
T- Type of the binary object.- Parameters:
obj- Object to convert.- Returns:
- Converted object or
nullif obj is null. - Throws:
BinaryObjectException- In case of error.
-
builder
public BinaryObjectBuilder builder(String typeName)
Creates new binary builder.- Specified by:
builderin interfaceIgniteBinary- Parameters:
typeName- Type name.- Returns:
- Newly binary builder.
-
builder
public BinaryObjectBuilder builder(BinaryObject binaryObj)
Creates binary builder initialized by existing binary object.- Specified by:
builderin interfaceIgniteBinary- Parameters:
binaryObj- Binary object to initialize builder.- Returns:
- Binary builder.
-
type
@Nullable public @Nullable BinaryType type(Class<?> cls) throws BinaryObjectException
Gets metadata for provided class.- Specified by:
typein interfaceIgniteBinary- Parameters:
cls- Class.- Returns:
- Metadata.
- Throws:
BinaryObjectException- In case of error.
-
type
@Nullable public @Nullable BinaryType type(String typeName) throws BinaryObjectException
Gets metadata for provided class name.- Specified by:
typein interfaceIgniteBinary- Parameters:
typeName- Type name.- Returns:
- Metadata.
- Throws:
BinaryObjectException- In case of error.
-
type
@Nullable public @Nullable BinaryType type(int typeId) throws BinaryObjectException
Gets metadata for provided type ID.- Specified by:
typein interfaceIgniteBinary- Parameters:
typeId- Type ID.- Returns:
- Metadata.
- Throws:
BinaryObjectException- In case of error.
-
types
public Collection<BinaryType> types() throws BinaryObjectException
Gets metadata for all known types.- Specified by:
typesin interfaceIgniteBinary- Returns:
- Metadata.
- Throws:
BinaryObjectException- In case of error.
-
buildEnum
public BinaryObject buildEnum(String typeName, int ord)
Create enum object using value.- Specified by:
buildEnumin interfaceIgniteBinary- Parameters:
typeName- Type name.ord- Ordinal.- Returns:
- Enum object.
-
buildEnum
public BinaryObject buildEnum(String typeName, String name)
Create enum object using name.- Specified by:
buildEnumin interfaceIgniteBinary- Parameters:
typeName- Type name.name- Name.- Returns:
- Enum object.
-
registerEnum
public BinaryType registerEnum(String typeName, Map<String,Integer> vals)
Register enum type.- Specified by:
registerEnumin interfaceIgniteBinary- 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:
registerClassin interfaceIgniteBinary- Parameters:
cls- Class.- Returns:
- Metadata.
- Throws:
BinaryObjectException- In case of error.
-
processor
public IgniteCacheObjectProcessor processor()
- Returns:
- Binary processor.
-
-