Class Field<T>
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.nd.field.Field<T>
- Type Parameters:
T-
- All Implemented Interfaces:
IDestructableField,IField
Used to represent a single field of an object stored in the database. Objects
which store themselves in the database should store a set of static final
FieldDefinitions at the top of their class definition to indicate their memory map.
This serves as a standard way to document the memory map for such structs, provides
access to the field offsets, and provides a convenience getter.
There are two ways to use this. Callers can either use the "get" method to access the value of the field, or can use the public "offset" attribute to perform the reads manually. The get function is more convenient but allocates objects and so should probably not be used for frequently-accessed fields or primitive types that would end up being autoboxed unnecessarily.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Field<T>Creates a newFieldin the given struct with the given type.voidintReturns 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.booleanprotected voidsetFieldName(String fieldName)voidsetOffset(int offset)Sets the field offset (bytes from the start of the struct).
-
Field Details
-
factory
-
offset
protected int offset
-
-
Constructor Details
-
Field
-
-
Method Details
-
get
-
hasDestructor
public boolean hasDestructor() -
destruct
- Specified by:
destructin interfaceIDestructableField
-
getRecordSize
public int getRecordSize()Description copied from interface:IFieldReturns the size of the field, in bytes.- Specified by:
getRecordSizein interfaceIField
-
getAlignment
public int getAlignment()Description copied from interface:IFieldReturns the required byte alignment for the field.- Specified by:
getAlignmentin interfaceIField
-
create
Creates a newFieldin the given struct with the given type.- Parameters:
struct- the struct that will contain the newly-created field (must not have hadStructDef.done()called on it yet).fieldType- the data type for the contents of the newly created field- Returns:
- the newly-constructed field
-
setFieldName
-
setOffset
public final void setOffset(int offset)Description copied from interface:IFieldSets 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. -
getOffset
public final int getOffset()Description copied from interface:IFieldReturns the field offset, in bytes from the start of the struct. -
getFieldName
Description copied from interface:IFieldReturns 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.- Specified by:
getFieldNamein interfaceIField
-