@Target(value={TYPE,PACKAGE}) @Retention(value=CLASS) public @interface AutoProtoSchemaBuilder
SerializationContextInitializer. Annotate a class or interface
extending from SerializationContextInitializer with this annotation and a new concrete public class named
based on className(), having a default no-arguments public constructor will be generated at compile time in
the same package. The implementations of the methods from SerializationContextInitializer will be generated
based on the information provided in the attributes of this annotation.
This annotation is used at compile time annotation processing only and should not be relied upon at runtime, so its
retention is set to RetentionPolicy.CLASS.
NOTE: This annotation can also be used on packages but this kind of usage has been deprecated in 4.3.4 and will be removed in version 5. See IPROTO-157.
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
autoImportClasses
Deprecated.
since 4.3.4. This will be removed in version 5. See IPROTO-158.
|
String[] |
basePackages
The list of packages to scan (optional).
|
String |
className
The name of the generated Java implementation class (optional).
|
Class<? extends SerializationContextInitializer>[] |
dependsOn
The
SerializationContextInitializers that must be executed before this one. |
Class<?>[] |
excludeClasses
Classes to be explicitly excluded.
|
Class<?>[] |
includeClasses
Annotated classes to process (optional).
|
boolean |
marshallersOnly
Generate only the marshallers and skip the schema file.
|
String |
schemaFileName
The generated Protobuf schema file name (optional).
|
String |
schemaFilePath
Generated Protobuf schema resource file path (optional).
|
String |
schemaPackageName
Package of the generated Protobuf schema.
|
boolean |
service
Enable generation of a
META-INF/services file for the generated implementation class of the SerializationContextInitializer to become loadable by the ServiceLoader. |
String[] |
value
A handy alias for
basePackages(). |
public abstract String className
public abstract String schemaFileName
'/' characters, so it might appear like
a relative or absolute file name. Must end with ".proto" suffix. The schema will be registered under this name in
the SerializationContext by SerializationContextInitializer.registerSchema(SerializationContext).
If missing, the simple name of the annotated class plus the ".proto" suffix will be used by default.public abstract String schemaFilePath
public abstract String schemaPackageName
public abstract String[] value
basePackages(). value and basePackages() are mutually exclusive.
See basePackages() for usage.public abstract String[] basePackages
basePackages and includeClasses() are mutually exclusive.
The packages are scanned for annotated classes recursively. If basePackages is empty then all packages are
considered, starting from root and including the default (unnamed) package. The packages are filtered based on the
excludeClasses() filter. If neither includeClasses() nor basePackages is specified then the
entire source path is scanned. Be wary of using this last option in anything but very simple demo projects.public abstract Class<?>[] includeClasses
includeClasses is empty, all ProtoXyz annotated
classes that belong to the packages listed in basePackages() will be scanned. If neither
includeClasses nor basePackages() was specified then the entire source path will be
scanned. Be wary of using this last option in anything but very simple demo projects.public abstract Class<?>[] excludeClasses
excludeClasses and includeClasses() are mutually exclusive. This
can be used together with basePackages().@Deprecated public abstract boolean autoImportClasses
includeClasses() or basePackages() to
be auto-detected by reference from the already included classes and to be added automatically. If this is set to
false (which is the default) it results in a compilation error when such a case is encountered.public abstract boolean service
META-INF/services file for the generated implementation class of the SerializationContextInitializer to become loadable by the ServiceLoader. This is optional and
provided for convenience only. The ProtoStream library does not make any use of the
ServiceLoader to benefit from this mechanism but the user's application is free to use it.public abstract boolean marshallersOnly
The schema is actually always generated at compile time, in memory, so that various validations can be performed
at compile time, but with this flag you effectively ensure it finally gets excluded from both the generated source
code and the generated resource files and it does not get registered at runtime by this
SerializationContextInitializer implementation. This flag is useful in cases where you want to register
the schema manually for whatever reason or the schema is already provided/registered by other parts of your
application.
This option conflicts with schemaFilePath() and they cannot be used together. Also, this option cannot be
set to true if the annotated element is a subtype of GeneratedSchema,
which is expected to always provide a generated schema, as the name implies.
public abstract Class<? extends SerializationContextInitializer>[] dependsOn
SerializationContextInitializers that must be executed before this one. Classes or interfaces listed
here must implement SerializationContextInitializer and must also be annotated with
AutoProtoSchemaBuilder. Classes not annotated with AutoProtoSchemaBuilder will result in a
compilation error.Copyright © 2021 JBoss, a division of Red Hat. All rights reserved.