Module uk.autores
Package uk.autores

Annotation Type ResourceFiles


  • @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 resource foo/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 a Namer via processing(). The compiler must be able to load and instantiate any value set in handler(). This typically means compiling the code in a separate project to the one where they are used.

    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String[] value
      Defines the resource files to be processed.
    • Element Detail

      • value

        String[] value
        Defines the resource files to be processed. In an Apache Maven project these will likely be placed in the src/main/resources directory.
        Returns:
        the resources to handle
      • processing

        Processing processing
        Common processing instructions
        Returns:
        processing instructions
        Default:
        @uk.autores.Processing(namer=uk.autores.naming.Namer.class)