Annotation Interface InlineMe


@Documented @Target({METHOD,CONSTRUCTOR}) public @interface InlineMe
Indicates that calls to the annotated method or constructor can be replaced with the provided replacement template.

This annotation is typically used to mark methods or constructors that are deprecated and have a preferred alternative implementation. The replacement template should provide a way to achieve the same functionality as the annotated method or constructor, but using a different approach.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    A Java template that can be used to replace calls to the annotated method.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional imports required by the replacement template.
    Optional static imports required by the replacement template.
  • Element Details

    • replacement

      String replacement
      A Java template that can be used to replace calls to the annotated method. Typically starts with this. for method invocations in the same class, or this(, for constructor invocations in the same class.

      Replacement templates may refer to elements from other classes, provided the necessary imports are passed in.

      Replacement templates can reference method parameters by name, and can also reference this.

      Returns:
      a Java template that can be used to replace calls to the annotated method.
    • imports

      String[] imports
      Optional imports required by the replacement template.
      Returns:
      imports to be used when compiling the replacement template, and added to the source file if necessary.
      Default:
      {}
    • staticImports

      String[] staticImports
      Optional static imports required by the replacement template.
      Returns:
      static imports to be used when compiling the replacement template, and added to the source file if necessary.
      Default:
      {}