Annotation Type ProtoReserved
-
@Target(TYPE) @Retention(RUNTIME) @Documented @Repeatable(ProtoReservedStatements.class) public @interface ProtoReserved
Injects 'reserved' statements in the generated schema of a message or enum type. The 'reserved' statement is added inside the generated message or enum definition, right at the beginning. Mixing numbers, ranges and names in a single annotation instance is allowed (for your convenience) but results in separate statements being generated for numbers and names because protobuf does not allow mixing them.All
ProtoReserved
annotations from the superclass and implemented/extended interfaces are inherited (recursively up the hierarchy) and the numbers, ranges and names are merged. No duplicates or overlaps must be found in the process or else an error will be generated. Regardless of how many annotations are found, after merging at most two 'reserved' statements will be issued, one for numbers/ranges and one for names. Their contents will be sorted ascendingly.This annotation is not explicitly marked
Inherited
but annotation processors will scan for occurrences of this annotation in all superclasses and superinterfaces (recursively).- Since:
- 4.3
- Author:
- [email protected]
- See Also:
- Protocol Buffers Language Guide - Reserved Fields, Protocol Buffers Language Guide - Reserved Values
-
-
Element Detail
-
value
int[] value
Alias fornumbers()
(mutually exclusive).- Default:
- {}
-
-
-
numbers
int[] numbers
Numbers to reserve. Alias forvalue()
(mutually exclusive).- Default:
- {}
-
-
-
ranges
ProtoReserved.Range[] ranges
Number ranges to be reserved.- Default:
- {}
-
-
-
names
String[] names
Names to be reserved.- Default:
- {}
-
-