Annotation Type DefaultMethodHandle


  • @Documented
    @Retention(RUNTIME)
    @Target(PARAMETER)
    public @interface DefaultMethodHandle
    A parameter with this annotation is assigned an instance of java.lang.invoke.MethodHandle 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. Note that requesting such a method exposes the default method to reflective access.
    See Also:
    MethodDelegation, TargetMethodAnnotationDrivenBinder
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean nullIfImpossible
      Indicates that null should be assigned to this parameter if no default method is invokable.
      java.lang.Class<?> targetType
      Specifies an explicit type that declares the default method to invoke.
    • Element Detail

      • targetType

        java.lang.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