@Retention(value=RUNTIME) @Target(value=FIELD) public @interface FieldGroup
The FieldGroup
annotation is retained at runtime and can be used to annotate
fields within a class. The name of the group is specified through the 'value' method,
allowing multiple fields to be associated with the same group by assigning them the same name.
One common use case is organizing the memory layout for serialization or memory-mapped objects where fields that are accessed together are placed adjacently in memory.
Example:
public class Record { @FieldGroup("header") private int headerField1; @FieldGroup("header") private int headerField2; @FieldGroup("body") private int bodyField1, bodyField2; }
@Deprecated public static final String HEADER
public abstract String value
value
are considered
part of the same logical group.Copyright © 2024. All rights reserved.