-
@Target({PACKAGE,TYPE}) @Retention(SOURCE) @Repeatable(uk.autores.repeat.RepeatableResources.class) public @interface ResourceFiles
Indicates resources that are to be processed at compile time.
@ResourceFiles("some-resource.txt")
The compiler must be able to load referenced resources using
Filer.getResource(JavaFileManager.Location, CharSequence, CharSequence)
.It is recommended that resources be placed in a bundled directory path equivalent to the type or package. For example, annotated class
foo.bar.Baz
can reference the relative resourcefoo/bar/X.txt
with the string"X.txt"
.Absolute paths like
"/META-INF/resources/X.txt
must be start with a forward slash.As a minimum this annotation can be used to verify a resource exists without the need for unit tests. Set
handler()
for other behaviour.Custom generation or validation can be provided by implementing a
Handler
. Alternative naming strategies can be set by providing aNamer
viaprocessing()
. The compiler must be able to load and instantiate any value set inhandler()
. This typically means compiling the code in a separate project to the one where they are used.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description ResourceFiles.Cfg[]
config
Some implementations ofHandler
support configuration.Class<? extends Handler>
handler
Enables non-default resource handling.Processing
processing
Common processing instructions
-
-
-
Element Detail
-
value
String[] value
Defines the resource files to be processed. In an Apache Maven project these will likely be placed in thesrc/main/resources
directory.- Returns:
- the resources to handle
-
-
-
handler
Class<? extends Handler> handler
Enables non-default resource handling.- Returns:
- the Handler for these resources
- See Also:
Handler for provided implementations
- Default:
- uk.autores.handling.AssertResourceExists.class
-
-
-
processing
Processing processing
Common processing instructions- Returns:
- processing instructions
- Default:
- @uk.autores.Processing(namer=uk.autores.naming.Namer.class)
-
-
-
config
ResourceFiles.Cfg[] config
Some implementations ofHandler
support configuration.- Returns:
- configured options
- See Also:
Handler.config()
- Default:
- {}
-
-