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 ofIgniteBinary.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BinaryContextbinaryContext()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.BinaryTyperegisterClass(Class<?> cls)Register binary type for specified class.BinaryTyperegisterEnum(String typeName, Map<String,Integer> vals)Register enum type.<T> TtoBinary(Object obj)Converts provided object to instance ofBinaryObject.BinaryTypetype(int typeId)Gets metadata for provided type ID.BinaryTypetype(Class<?> cls)Gets metadata for provided class.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.
-
-
-
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(Object obj)
Converts 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.
-
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
public 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
public BinaryType type(String typeName)
Gets metadata for provided class name.- Specified by:
typein interfaceIgniteBinary- Parameters:
typeName- Type name.- Returns:
- Metadata.
-
type
public BinaryType type(int typeId)
Gets metadata for provided type ID.- Specified by:
typein interfaceIgniteBinary- Parameters:
typeId- Type ID.- Returns:
- Metadata.
-
types
public Collection<BinaryType> types()
Gets metadata for all known types.- Specified by:
typesin interfaceIgniteBinary- Returns:
- Metadata.
-
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.
-
binaryContext
public BinaryContext binaryContext()
- Returns:
- Binary context.
-
-