@Target(value=METHOD) @Retention(value=RUNTIME) @Documented public @interface Align
offset(), the range of the field's bytes offsets don't cross the specified dontCross()
boundary. This annotation should be put on any single method accessing the field: getter, or
setter, or adder, etc.
This annotation guarantees alignment from the beginning of the instance, so to ensure alignment in the native memory, the instance as a whole should be aligned by native memory addresses to the most coarse alignment of it's fields.
The default alignment depends on the field type, see DEFAULT.
| Modifier and Type | Fields and Description |
|---|---|
static int |
DEFAULT
If the field type is an integer or a floating point primitive, default
dontCross() alignment is equivalent to 1-byte for fields which take <= 8 bits, 2-byte
for fields which take <= 16 bits, 4-byte for fields which take <= 32 bits, 8-byte for
fields which take <= 64 bits. |
static int |
NO_ALIGNMENT
0 represents no particular alignment (shouldn't align the field start, shouldn't track
crossing of any border).
|
public static final int DEFAULT
dontCross() alignment is equivalent to 1-byte for fields which take <= 8 bits, 2-byte
for fields which take <= 16 bits, 4-byte for fields which take <= 32 bits, 8-byte for
fields which take <= 64 bits. offset() alignment is 1-byte for such fields.offset alignment is
ValueModel.recommendedOffsetAlignment() for this sub-value interface. dontCross default alignment for Value fields is NO_ALIGNMENT.offset alignment is equivalent to the
maximum of it's element offset or dontCross alignment, default dontCross for array fields is NO_ALIGNMENT.
CharSequence type, default dontCross alignment
is NO_ALIGNMENT. Default offset alignment is not applicable for
CharSequence fields, must be specified explicitly.boolean type, default alignment is not applicable, both
offset and dontCross alignment values must be specified explicitly.public static final int NO_ALIGNMENT
Copyright © 2022. All rights reserved.