Module uk.autores

Annotation Type 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.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Configuration option.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Defines the resource files to be processed.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Some implementations of Handler support configuration.
    Class<? extends Handler>
    Enables non-default resource handling.
    Common processing instructions
  • Element Details

    • 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
    • handler

      Class<? extends Handler> handler
      Enables non-default resource handling.
      Returns:
      the Handler for these resources
      See Also:
      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

      Some implementations of Handler support configuration.
      Returns:
      configured options
      See Also:
      Default:
      {}