Interface IField
- All Known Implementing Classes:
Field,FieldByte,FieldChar,FieldDouble,FieldFloat,FieldInt,FieldList,FieldLong,FieldManyToOne,FieldOneToMany,FieldOneToOne,FieldPointer,FieldSearchIndex,FieldSearchKey,FieldShort,FieldString
public interface IField
Represents a single field of a struct in the
Database. Holds metadata for that field
and permits laziy initialization of the field offset. Fields are normally instantiated as static
variables. Collectively, they describe the database schema but they are not associated with any
particular instance of data in the database.
Fields are temporarily mutable. On construction, a number of attributes (such as offset) are
computed in a second pass or are initialized as other fields are constructed. Generally such
attributes can't be computed in the constructor since they depend on knowledge of other fields
that must be instantiated first. However, once StructDef.done() has been called on the
last StructDef, fields are immutable and should not ever be modified again.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the required byte alignment for the field.Returns the name of the field.intReturns the field offset, in bytes from the start of the struct.intReturns the size of the field, in bytes.voidsetOffset(int offset)Sets the field offset (bytes from the start of the struct).
-
Method Details
-
setOffset
void setOffset(int offset)Sets the field offset (bytes from the start of the struct). This is invoked some time after field construction, after the sizes of all preceeding fields are known. -
getRecordSize
int getRecordSize()Returns the size of the field, in bytes. -
getAlignment
default int getAlignment()Returns the required byte alignment for the field. -
getFieldName
String getFieldName()Returns the name of the field. This is mainly used for error messages, debug output, and diagnostic tools. Meant to be programmer-readable but not user-readable. -
getOffset
int getOffset()Returns the field offset, in bytes from the start of the struct.
-