Package com.hazelcast.nio.serialization
Class ClassDefinitionBuilder
- java.lang.Object
-
- com.hazelcast.nio.serialization.ClassDefinitionBuilder
-
public final class ClassDefinitionBuilder extends java.lang.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 SerializationServiceClassDefinitionBuilder(PortableId portableId)
IMPORTANT: Make sure that the version matches the portableVersion in the SerializationService
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ClassDefinitionBuilder
addBooleanArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addBooleanField(java.lang.String fieldName)
ClassDefinitionBuilder
addByteArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addByteField(java.lang.String fieldName)
ClassDefinitionBuilder
addCharArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addCharField(java.lang.String fieldName)
ClassDefinitionBuilder
addDateArrayField(java.lang.String fieldName)
Adds an array of Date's to the class definitionClassDefinitionBuilder
addDateField(java.lang.String fieldName)
Adds a date field consisting of year, month of the year and day of the month to the class definitionClassDefinitionBuilder
addDecimalArrayField(java.lang.String fieldName)
Adds an array of Decimal's to the class definitionClassDefinitionBuilder
addDecimalField(java.lang.String fieldName)
Adds a decimal which is arbitrary precision and scale floating-point number to the class definitionClassDefinitionBuilder
addDoubleArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addDoubleField(java.lang.String fieldName)
void
addField(com.hazelcast.internal.serialization.impl.portable.FieldDefinitionImpl fieldDefinition)
ClassDefinitionBuilder
addFloatArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addFloatField(java.lang.String fieldName)
ClassDefinitionBuilder
addIntArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addIntField(java.lang.String fieldName)
ClassDefinitionBuilder
addLongArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addLongField(java.lang.String fieldName)
ClassDefinitionBuilder
addPortableArrayField(java.lang.String fieldName, ClassDefinition classDefinition)
ClassDefinitionBuilder
addPortableField(java.lang.String fieldName, ClassDefinition classDefinition)
ClassDefinitionBuilder
addShortArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addShortField(java.lang.String fieldName)
ClassDefinitionBuilder
addStringArrayField(java.lang.String fieldName)
ClassDefinitionBuilder
addStringField(java.lang.String fieldName)
ClassDefinitionBuilder
addTimeArrayField(java.lang.String fieldName)
Adds an array of Time's to the class definitionClassDefinitionBuilder
addTimeField(java.lang.String fieldName)
Adds a time field consisting of hour, minute, seconds and nanos parts to the class definitionClassDefinitionBuilder
addTimestampArrayField(java.lang.String fieldName)
Adds an array of Timestamp's to the class definitionClassDefinitionBuilder
addTimestampField(java.lang.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(java.lang.String fieldName)
Adds an array of TimestampWithTimezone's to the class definitionClassDefinitionBuilder
addTimestampWithTimezoneField(java.lang.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(java.lang.String fieldName)
Deprecated.for the sake of better naming.ClassDefinitionBuilder
addUTFField(java.lang.String fieldName)
Deprecated.for the sake of better naming.ClassDefinition
build()
int
getClassId()
int
getFactoryId()
PortableId
getPortableId()
int
getVersion()
-
-
-
Constructor Detail
-
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
-
ClassDefinitionBuilder
public ClassDefinitionBuilder(int factoryId, int classId, int version)
IMPORTANT: Make sure that the version matches the portableVersion in the SerializationService
-
ClassDefinitionBuilder
public ClassDefinitionBuilder(PortableId portableId)
IMPORTANT: Make sure that the version matches the portableVersion in the SerializationService- Since:
- 5.4
-
-
Method Detail
-
addIntField
@Nonnull public ClassDefinitionBuilder addIntField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addLongField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull @Deprecated public ClassDefinitionBuilder addUTFField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addStringField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addBooleanField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addByteField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addBooleanArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addCharField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addDoubleField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addFloatField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addShortField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addDecimalField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addTimeField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addDateField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addTimestampField(@Nonnull java.lang.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 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
@Nonnull public ClassDefinitionBuilder addTimestampWithTimezoneField(@Nonnull java.lang.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 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
@Nonnull public ClassDefinitionBuilder addByteArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addCharArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addIntArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addLongArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addDoubleArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addFloatArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull public ClassDefinitionBuilder addShortArrayField(@Nonnull java.lang.String fieldName)
- 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
@Nonnull @Deprecated public ClassDefinitionBuilder addUTFArrayField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addStringArrayField(@Nonnull java.lang.String fieldName)
- 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 java.lang.String fieldName, ClassDefinition classDefinition)
- 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 java.lang.String fieldName, ClassDefinition classDefinition)
- Parameters:
fieldName
- name of the field that will be added to this class definitionclassDefinition
- class definition of the nested portable 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()
-
addDecimalArrayField
@Nonnull public ClassDefinitionBuilder addDecimalArrayField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addTimeArrayField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addDateArrayField(@Nonnull java.lang.String fieldName)
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
@Nonnull public ClassDefinitionBuilder addTimestampArrayField(@Nonnull java.lang.String fieldName)
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 java.lang.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
@Nonnull public ClassDefinition build()
- Returns:
- creates and returns a new ClassDefinition
-
getFactoryId
public int getFactoryId()
-
getClassId
public int getClassId()
-
getVersion
public int getVersion()
-
getPortableId
public PortableId getPortableId()
- Since:
- 5.4
-
-