public interface AOTContext
Modifier and Type | Method and Description |
---|---|
void |
addDiagnostics(java.lang.String category,
java.lang.String message)
Adds a diagnostic message, which is going to be written
in a log file.
|
<T> java.util.Optional<T> |
get(java.lang.Class<T> type)
Reads an entry from the context.
|
ApplicationContextAnalyzer |
getAnalyzer()
Returns the application context analyzer.
|
Configuration |
getConfiguration()
Returns the source generators configuration.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getDiagnostics()
Returns the diagnostics map.
|
java.lang.String |
getPackageName()
The package which should be used for generated classes.
|
Runtime |
getRuntime()
Returns the target runtime environment.
|
com.squareup.javapoet.JavaFile |
javaFile(com.squareup.javapoet.TypeSpec typeSpec)
Generates a java file spec.
|
<T> void |
put(java.lang.Class<T> type,
T value)
Stores an entry in the context.
|
void |
registerClassNeededAtCompileTime(java.lang.Class<?> clazz)
Registers a class as needed at compile time (where compile time
is the compile time of generated classes).
|
void |
registerExcludedResource(java.lang.String path)
Registers a resource path as excluded.
|
void |
registerGeneratedResource(java.lang.String path,
java.util.function.Consumer<? super java.io.File> consumer)
Registers a new generated resource.
|
void |
registerGeneratedSourceFile(com.squareup.javapoet.JavaFile javaFile)
Registers a generated source file.
|
void |
registerStaticInitializer(com.squareup.javapoet.MethodSpec staticInitializer)
Registers a code block to be executed statically when
the optimized binary is loaded.
|
@NonNull java.lang.String getPackageName()
@NonNull Configuration getConfiguration()
@NonNull ApplicationContextAnalyzer getAnalyzer()
void registerGeneratedSourceFile(@NonNull com.squareup.javapoet.JavaFile javaFile)
javaFile
- the file to be added.void registerStaticInitializer(com.squareup.javapoet.MethodSpec staticInitializer)
staticInitializer
- the static initializer methodvoid registerGeneratedResource(@NonNull java.lang.String path, java.util.function.Consumer<? super java.io.File> consumer)
path
- the relative path to the resource (including file name)consumer
- the consumer to be called when the resource is generated.void registerExcludedResource(@NonNull java.lang.String path)
path
- the path of the resource to excludevoid registerClassNeededAtCompileTime(@NonNull java.lang.Class<?> clazz)
clazz
- a class@NonNull com.squareup.javapoet.JavaFile javaFile(com.squareup.javapoet.TypeSpec typeSpec)
typeSpec
- the type spec of the main class@NonNull void addDiagnostics(java.lang.String category, java.lang.String message)
category
- a category for the message, typically corresponding
to the source generator typemessage
- a message to log<T> void put(@NonNull java.lang.Class<T> type, @NonNull T value)
T
- the type of the valuetype
- the class of the value to storevalue
- the value to store@NonNull <T> java.util.Optional<T> get(@NonNull java.lang.Class<T> type)
T
- the type of the entrytype
- the class of the entry@NonNull java.util.Map<java.lang.String,java.util.List<java.lang.String>> getDiagnostics()
@NonNull Runtime getRuntime()