Annotation Interface Substitute

@Retention(RUNTIME) @Target({METHOD,CONSTRUCTOR,TYPE,FIELD}) public @interface Substitute
When used to annotate a method, it indicates that a method declaration is intended to be a substitute for a method declaration in another class. A substitute method must be declared in a class annotated with TargetClass as the value element of that annotation specifies the class containing the method to be substituted (the substitutee class).

The method to be substituted is determined based on a name and a list of parameter types. The name is specified by an optional element of this annotation. If this element is not specified, then the name of the substitution method is used. The parameter types are those of the substitution method.

There must never be an explicit call to a non-static method annotated with Substitute unless it is from another non-static method in the same class.

When used to annotate a class, it indicates that the class is intended to be a full substitute for the class specified via TargetClass. All methods in the target class that are not substituted in the annotated class are implicitly treated as Deleted.

See TargetClass for an overview of the annotation system.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
  • Element Details

    • polymorphicSignature

      boolean polymorphicSignature