Package com.hazelcast.nio.serialization
Class ClassDefinitionBuilder
java.lang.Object
com.hazelcast.nio.serialization.ClassDefinitionBuilder
public final class ClassDefinitionBuilder extends Object
ClassDefinitionBuilder is used to build and register ClassDefinitions manually.
-
Constructor Summary
Constructors Constructor Description ClassDefinitionBuilder(int factoryId, int classId)
IMPORTANT: It uses a default portableVersion (0) for non-versioned classes.ClassDefinitionBuilder(int factoryId, int classId, int version)
IMPORTANT: Make sure that the version matches the portableVersion in the SerializationService -
Method Summary
Modifier and Type Method Description ClassDefinitionBuilder
addBooleanArrayField(String fieldName)
ClassDefinitionBuilder
addBooleanField(String fieldName)
ClassDefinitionBuilder
addByteArrayField(String fieldName)
ClassDefinitionBuilder
addByteField(String fieldName)
ClassDefinitionBuilder
addCharArrayField(String fieldName)
ClassDefinitionBuilder
addCharField(String fieldName)
ClassDefinitionBuilder
addDateArrayField(String fieldName)
Adds an array of Date's to the class definitionClassDefinitionBuilder
addDateField(String fieldName)
Adds a date field consisting of year, month of the year and day of the month to the class definitionClassDefinitionBuilder
addDecimalArrayField(String fieldName)
Adds an array of Decimal's to the class definitionClassDefinitionBuilder
addDecimalField(String fieldName)
Adds a decimal which is arbitrary precision and scale floating-point number to the class definitionClassDefinitionBuilder
addDoubleArrayField(String fieldName)
ClassDefinitionBuilder
addDoubleField(String fieldName)
void
addField(com.hazelcast.internal.serialization.impl.portable.FieldDefinitionImpl fieldDefinition)
ClassDefinitionBuilder
addFloatArrayField(String fieldName)
ClassDefinitionBuilder
addFloatField(String fieldName)
ClassDefinitionBuilder
addIntArrayField(String fieldName)
ClassDefinitionBuilder
addIntField(String fieldName)
ClassDefinitionBuilder
addLongArrayField(String fieldName)
ClassDefinitionBuilder
addLongField(String fieldName)
ClassDefinitionBuilder
addPortableArrayField(String fieldName, ClassDefinition classDefinition)
ClassDefinitionBuilder
addPortableField(String fieldName, ClassDefinition def)
ClassDefinitionBuilder
addShortArrayField(String fieldName)
ClassDefinitionBuilder
addShortField(String fieldName)
ClassDefinitionBuilder
addStringArrayField(String fieldName)
ClassDefinitionBuilder
addStringField(String fieldName)
ClassDefinitionBuilder
addTimeArrayField(String fieldName)
Adds an array of Time's to the class definitionClassDefinitionBuilder
addTimeField(String fieldName)
Adds a time field consisting of hour, minute, seconds and nanos parts to the class definitionClassDefinitionBuilder
addTimestampArrayField(String fieldName)
Adds an array of Timestamp's to the class definitionClassDefinitionBuilder
addTimestampField(String fieldName)
Adds a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos parts to the class definitionClassDefinitionBuilder
addTimestampWithTimezoneArrayField(String fieldName)
Adds an array of TimestampWithTimezone's to the class definitionClassDefinitionBuilder
addTimestampWithTimezoneField(String fieldName)
Adds a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos parts to the class definitionClassDefinitionBuilder
addUTFArrayField(String fieldName)
Deprecated.for the sake of better naming.ClassDefinitionBuilder
addUTFField(String fieldName)
Deprecated.for the sake of better naming.ClassDefinition
build()
int
getClassId()
int
getFactoryId()
int
getVersion()
-
Constructor Details
-
ClassDefinitionBuilder
public ClassDefinitionBuilder(int factoryId, int classId)IMPORTANT: It uses a default portableVersion (0) for non-versioned classes. Make sure to specify the portableVersion in the constructor if you override the default portableVersion in the SerializationService- Parameters:
factoryId
- factoryId to useclassId
- classId to use
-
ClassDefinitionBuilder
public ClassDefinitionBuilder(int factoryId, int classId, int version)IMPORTANT: Make sure that the version matches the portableVersion in the SerializationService- Parameters:
factoryId
- factoryId to useclassId
- classId to useversion
- portableVersion to use
-
-
Method Details
-
addIntField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addLongField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addUTFField
Deprecated.for the sake of better naming. UseaddStringField(String)
instead.- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addStringField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addBooleanField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addByteField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addBooleanArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addCharField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addDoubleField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addFloatField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addShortField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addDecimalField
Adds a decimal which is arbitrary precision and scale floating-point number to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addTimeField
Adds a time field consisting of hour, minute, seconds and nanos parts to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addDateField
Adds a date field consisting of year, month of the year and day of the month to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addTimestampField
Adds a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos parts to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addTimestampWithTimezoneField
Adds a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos parts to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addByteArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addCharArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addIntArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addLongArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addDoubleArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addFloatArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addShortArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addUTFArrayField
Deprecated.for the sake of better naming. UseaddStringArrayField(String)
instead.- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addStringArrayField
- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addPortableField
@Nonnull public ClassDefinitionBuilder addPortableField(@Nonnull String fieldName, ClassDefinition def)- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addPortableArrayField
@Nonnull public ClassDefinitionBuilder addPortableArrayField(@Nonnull String fieldName, ClassDefinition classDefinition)- Parameters:
fieldName
- name of the field that will be add to this class definitionclassDefinition
- class definition of the nested portable that will be add to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
-
addDecimalArrayField
Adds an array of Decimal's to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
- See Also:
addDecimalField(String)
-
addTimeArrayField
Adds an array of Time's to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
- See Also:
addTimeField(String)
-
addDateArrayField
Adds an array of Date's to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
- See Also:
addDateField(String)
-
addTimestampArrayField
Adds an array of Timestamp's to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
- See Also:
addTimestampField(String)
-
addTimestampWithTimezoneArrayField
@Nonnull public ClassDefinitionBuilder addTimestampWithTimezoneArrayField(@Nonnull String fieldName)Adds an array of TimestampWithTimezone's to the class definition- Parameters:
fieldName
- name of the field that will be added to this class definition- Returns:
- itself for chaining
- Throws:
HazelcastSerializationException
- if a field with same name already exists or if this method is called afterbuild()
- See Also:
addTimestampWithTimezoneField(String)
-
addField
@PrivateApi public void addField(com.hazelcast.internal.serialization.impl.portable.FieldDefinitionImpl fieldDefinition) -
build
- Returns:
- creates and returns a new ClassDefinition
-
getFactoryId
public int getFactoryId() -
getClassId
public int getClassId() -
getVersion
public int getVersion()
-