Annotation Type StaticResource


@Target(FIELD) @Retention(SOURCE) @Documented public @interface StaticResource
Marker for a constant representing a static resource. The annotated field must be a compile-time String constant whose value denotes a resource path. For example, the resource might be an icon path intended for ImageUtilities.loadImage. The primary purpose of the annotation is for its processor, which will signal a compile-time error if the resource does not in fact exist - ensuring that at least this usage will not be accidentally broken by moving, renaming, or deleting the resource.
Since:
1.13
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    If true, consider the resource path to be relative to the current package.
    boolean
    If true, permit the resource to be in the classpath.
  • Element Details

    • searchClasspath

      boolean searchClasspath
      If true, permit the resource to be in the classpath. By default, it may only be in the sourcepath.
      Returns:
      true to search in classpath
      Default:
      false
    • relative

      boolean relative
      If true, consider the resource path to be relative to the current package. (../ sequences are permitted.) By default, it must be an absolute path (not starting with /).
      Returns:
      true to consider resource path to be relative to current package
      Default:
      false