Package com.hazelcast.nio.serialization
Interface ClassDefinition
-
public interface ClassDefinition
Defines a class schema forPortable
classes. It allows querying of field names, types, class IDs etc. It can be created manually usingClassDefinitionBuilder
or on demand during deserialization.- See Also:
Portable
,ClassDefinitionBuilder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
getClassId()
Returns the class ID.int
getFactoryId()
Returns the factory ID.FieldDefinition
getField(int fieldIndex)
Gets the FieldDefinition for a given fieldIndex.FieldDefinition
getField(java.lang.String name)
Gets the FieldDefinition for a particular field.int
getFieldClassId(java.lang.String fieldName)
Gets the class ID of a field.int
getFieldCount()
Returns the field count.java.util.Set<java.lang.String>
getFieldNames()
Returns a Set of all field names.FieldType
getFieldType(java.lang.String fieldName)
Get the FieldType for a given fieldName.default PortableId
getPortableId()
int
getVersion()
Returns the version.boolean
hasField(java.lang.String fieldName)
Checks if there exists a FieldDefinition with the given fieldName.
-
-
-
Method Detail
-
getField
FieldDefinition getField(java.lang.String name)
Gets the FieldDefinition for a particular field.- Parameters:
name
- name of the field- Returns:
- field definition by given name or null
-
getField
FieldDefinition getField(int fieldIndex)
Gets the FieldDefinition for a given fieldIndex.- Parameters:
fieldIndex
- index of the field- Returns:
- field definition by given index
- Throws:
java.lang.IndexOutOfBoundsException
- if the fieldIndex is invalid.
-
hasField
boolean hasField(java.lang.String fieldName)
Checks if there exists a FieldDefinition with the given fieldName.- Parameters:
fieldName
- field name- Returns:
- true if this class definition contains a field named by given name
-
getFieldNames
java.util.Set<java.lang.String> getFieldNames()
Returns a Set of all field names.- Returns:
- all field names contained in this class definition
-
getFieldType
FieldType getFieldType(java.lang.String fieldName)
Get the FieldType for a given fieldName.- Parameters:
fieldName
- name of the field- Returns:
- type of given field
- Throws:
java.lang.IllegalArgumentException
- if the field does not exist.
-
getFieldClassId
int getFieldClassId(java.lang.String fieldName)
Gets the class ID of a field.- Parameters:
fieldName
- name of the field- Returns:
- class ID of given field
- Throws:
java.lang.IllegalArgumentException
- if the field does not not exist
-
getFieldCount
int getFieldCount()
Returns the field count.- Returns:
- total field count
-
getFactoryId
int getFactoryId()
Returns the factory ID.- Returns:
- factory ID
-
getClassId
int getClassId()
Returns the class ID.- Returns:
- class ID
-
getVersion
int getVersion()
Returns the version.- Returns:
- version
-
getPortableId
default PortableId getPortableId()
- Returns:
- portable ID of this class
- Since:
- 5.4
-
-