- java.lang.Object
-
- uk.autores.handling.Context
-
public final class Context extends Object
Context information for processing resource files. Instances are created by the annotation processor and passed toHandler.handle(Context).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContext.BuilderImplementation of the builder pattern forContext.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Elementannotated()The annotated element.static Context.Builderbuilder()Builder pattern.List<Config>config()Configuration.ProcessingEnvironmentenv()Annotation processing environment.List<JavaFileManager.Location>locations()Filer locations to search.Namernamer()Naming strategy.Optional<String>option(ConfigDef def)Pkgpkg()The package of the annotated type.voidprintError(String msg)Convenience method for sending an error to theMessager.Context.Builderrebuild()Context.Builderinitialized from current state.List<Resource>resources()Resources to process.
-
-
-
Method Detail
-
builder
public static Context.Builder builder()
Builder pattern.- Returns:
- new builder
-
rebuild
public Context.Builder rebuild()
Context.Builderinitialized from current state.- Returns:
- new builder
-
option
public Optional<String> option(ConfigDef def)
- Parameters:
def- name provider- Returns:
- the value if present
- See Also:
ResourceFiles.Cfg
-
printError
public void printError(String msg)
Convenience method for sending an error to theMessager.- Parameters:
msg- the error message to be emitted- See Also:
ProcessingEnvironment.getMessager()
-
env
public ProcessingEnvironment env()
Annotation processing environment.- Returns:
- annotation processing environment
-
locations
public List<JavaFileManager.Location> locations()
Filer locations to search.- Returns:
- where resources are to be loaded from
- See Also:
Processing.locations(),ProcessingEnvironment.getFiler(),Filer.getResource(JavaFileManager.Location, CharSequence, CharSequence)
-
pkg
public Pkg pkg()
The package of the annotated type.- Returns:
- package information
-
annotated
public Element annotated()
The annotated element.- Returns:
- the annotated element - class or package
- See Also:
TypeElement,PackageElement
-
resources
public List<Resource> resources()
Resources to process.- Returns:
- unmodifiable resources list
- See Also:
ResourceFiles.value()
-
config
public List<Config> config()
Configuration.- Returns:
- unmodifiable configuration list
- See Also:
ResourceFiles.config()
-
namer
public Namer namer()
Naming strategy.- Returns:
- name resolver
- See Also:
Processing.namer()
-
-