Package com.hazelcast.nio.serialization
Interface ClassDefinition
public interface ClassDefinition
Defines a class schema for
Portable
classes. It allows querying of field names, types, class IDs etc.
It can be created manually using ClassDefinitionBuilder
or on demand during deserialization.- See Also:
Portable
,ClassDefinitionBuilder
-
Method Summary
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(String name)
Gets the FieldDefinition for a particular field.int
getFieldClassId(String fieldName)
Gets the class ID of a field.int
getFieldCount()
Returns the field count.Set<String>
getFieldNames()
Returns a Set of all field names.FieldType
getFieldType(String fieldName)
Get the FieldType for a given fieldName.int
getVersion()
Returns the version.boolean
hasField(String fieldName)
Checks if there exists a FieldDefinition with the given fieldName.
-
Method Details
-
getField
Gets the FieldDefinition for a particular field.- Parameters:
name
- name of the field- Returns:
- field definition by given name or null
-
getField
Gets the FieldDefinition for a given fieldIndex.- Parameters:
fieldIndex
- index of the field- Returns:
- field definition by given index
- Throws:
IndexOutOfBoundsException
- if the fieldIndex is invalid.
-
hasField
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
Returns a Set of all field names.- Returns:
- all field names contained in this class definition
-
getFieldType
Get the FieldType for a given fieldName.- Parameters:
fieldName
- name of the field- Returns:
- type of given field
- Throws:
IllegalArgumentException
- if the field does not exist.
-
getFieldClassId
Gets the class ID of a field.- Parameters:
fieldName
- name of the field- Returns:
- class ID of given field
- Throws:
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
-