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.
  See Also:
    `ClassDefinition`, `Portable`, `SerializationConfig.addClassDefinition(ClassDefinition)`

- - ### Constructor Summary

    Constructors
    Constructor and 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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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` | `addDoubleArrayField(String fieldName)`
    `ClassDefinitionBuilder` | `addDoubleField(String fieldName)`
    `ClassDefinitionBuilder` | `addField(com.hazelcast.internal.serialization.impl.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 def)`
    `ClassDefinitionBuilder` | `addPortableField(String fieldName, ClassDefinition def)`
    `ClassDefinitionBuilder` | `addShortArrayField(String fieldName)`
    `ClassDefinitionBuilder` | `addShortField(String fieldName)`
    `ClassDefinitionBuilder` | `addUTFArrayField(String fieldName)`
    `ClassDefinitionBuilder` | `addUTFField(String fieldName)`
    `ClassDefinition` | `build()`
    `int` | `getClassId()`
    `int` | `getFactoryId()`
    `int` | `getVersion()`

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

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

- - ### 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
      Parameters:
        `factoryId` - factoryId to use
        `classId` - 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 use
        `classId` - classId to use
        `version` - portableVersion to use

  - ### Method Detail

    - #### addIntField

          public ClassDefinitionBuilder addIntField(String fieldName)

    - #### addLongField

          public ClassDefinitionBuilder addLongField(String fieldName)

    - #### addUTFField

          public ClassDefinitionBuilder addUTFField(String fieldName)

    - #### addBooleanField

          public ClassDefinitionBuilder addBooleanField(String fieldName)

    - #### addByteField

          public ClassDefinitionBuilder addByteField(String fieldName)

    - #### addBooleanArrayField

          public ClassDefinitionBuilder addBooleanArrayField(String fieldName)

    - #### addCharField

          public ClassDefinitionBuilder addCharField(String fieldName)

    - #### addDoubleField

          public ClassDefinitionBuilder addDoubleField(String fieldName)

    - #### addFloatField

          public ClassDefinitionBuilder addFloatField(String fieldName)

    - #### addShortField

          public ClassDefinitionBuilder addShortField(String fieldName)

    - #### addByteArrayField

          public ClassDefinitionBuilder addByteArrayField(String fieldName)

    - #### addCharArrayField

          public ClassDefinitionBuilder addCharArrayField(String fieldName)

    - #### addIntArrayField

          public ClassDefinitionBuilder addIntArrayField(String fieldName)

    - #### addLongArrayField

          public ClassDefinitionBuilder addLongArrayField(String fieldName)

    - #### addDoubleArrayField

          public ClassDefinitionBuilder addDoubleArrayField(String fieldName)

    - #### addFloatArrayField

          public ClassDefinitionBuilder addFloatArrayField(String fieldName)

    - #### addShortArrayField

          public ClassDefinitionBuilder addShortArrayField(String fieldName)

    - #### addUTFArrayField

          public ClassDefinitionBuilder addUTFArrayField(String fieldName)

    - #### addPortableField

          public ClassDefinitionBuilder addPortableField(String fieldName,
                                                         ClassDefinition def)

    - #### addPortableArrayField

          public ClassDefinitionBuilder addPortableArrayField(String fieldName,
                                                              ClassDefinition def)

    - #### addField

          public ClassDefinitionBuilder addField(com.hazelcast.internal.serialization.impl.FieldDefinitionImpl fieldDefinition)

    - #### build

          public ClassDefinition build()

    - #### getFactoryId

          public int getFactoryId()

    - #### getClassId

          public int getClassId()

    - #### getVersion

          public int getVersion()

Copyright © 2020. All rights reserved.