Package com.igormaznitsa.jbbp.model
Class JBBPAbstractField
java.lang.Object
com.igormaznitsa.jbbp.model.JBBPAbstractField
- All Implemented Interfaces:
JBBPNamedField,Serializable
- Direct Known Subclasses:
JBBPAbstractArrayField,JBBPFieldBit,JBBPFieldBoolean,JBBPFieldByte,JBBPFieldDouble,JBBPFieldFloat,JBBPFieldInt,JBBPFieldLong,JBBPFieldShort,JBBPFieldString,JBBPFieldStruct,JBBPFieldUByte,JBBPFieldUInt,JBBPFieldUShort
The Class is the ancestor for all fields and arrays of fields.
- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JBBPNamedFieldInfoThe Field contains the field name infoprotected SerializableThe Variable can hold some payload. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the field name.Get the field path.Get the field name info.Get payload value saved by user.abstract StringGet the field type in string representation.voidsetPayload(Serializable value) Set payload value.
-
Field Details
-
fieldNameInfo
The Field contains the field name info -
payload
The Variable can hold some payload. It is not used by JBBP and can be used without restrictions. By default, it is null. The Field is not thread safe.- Since:
- 1.2.0
-
-
Constructor Details
-
JBBPAbstractField
The Constructor.- Parameters:
namedField- the name field info for the field, it can be null.
-
-
Method Details
-
getPayload
Get payload value saved by user. The Operation is not thread safe.- Returns:
- payload value, can be null
- Since:
- 1.2.0
-
setPayload
Set payload value. The Operation is not thread safe.- Parameters:
value- payload value, can be null.- Since:
- 1.2.0
-
getNameInfo
Get the field name info.- Specified by:
getNameInfoin interfaceJBBPNamedField- Returns:
- the field name info if it is presented, otherwise null
-
getFieldPath
Get the field path.- Returns:
- the field path or null if the field doesn't contain any field name info
-
getFieldName
Get the field name.- Returns:
- the field name or null if the field doesn't contain any field name info
-
getTypeAsString
Get the field type in string representation.- Returns:
- the string representation of field type, like 'int', 'long', 'bool [123]'
- Since:
- 1.2.0
-