Annotation Interface DefaultMethod


@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface DefaultMethod
A parameter with this annotation is assigned an instance of Method which invokes a default method implementation of this method. If such a method is not available, this annotation causes that this delegation target cannot be bound unless nullIfImpossible() is set to true. The method is declared as public and is invokable unless the instrumented type itself is not visible. Note that requesting such a method exposes the super method to reflection.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    A binder for the DefaultMethod annotation.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Indicates if the instance assigned to this parameter should be stored in a static field for reuse.
    boolean
    Indicates that null should be assigned to this parameter if no default method is invokable.
    boolean
    Indicates if the instance assigned to this parameter should be looked up using an java.security.AccessController.
    Specifies an explicit type that declares the default method to invoke.
  • Element Details

    • cached

      boolean cached
      Indicates if the instance assigned to this parameter should be stored in a static field for reuse.
      Returns:
      true if this method instance should be cached.
      Default:
      true
    • privileged

      boolean privileged
      Indicates if the instance assigned to this parameter should be looked up using an java.security.AccessController.
      Returns:
      true if this method should be looked up using an java.security.AccessController.
      Default:
      false
    • targetType

      Class<?> targetType
      Specifies an explicit type that declares the default method to invoke.
      Returns:
      The type declaring the method to invoke or TargetType to indicate that the instrumented method declared the method.
      Default:
      void.class
    • nullIfImpossible

      boolean nullIfImpossible
      Indicates that null should be assigned to this parameter if no default method is invokable.
      Returns:
      true if null should be assigned if no valid method can be assigned.
      Default:
      false