Interface ParameterContext

    • Method Detail

      • getTarget

        Optional<Object> getTarget()
        Get the target on which the Executable that declares the Parameter for this context will be invoked, if available.
        Returns:
        an Optional containing the target on which the Executable will be invoked; never null but will be empty if the Executable is a constructor or a static method.
      • findAnnotation

        <A extends AnnotationOptional<A> findAnnotation​(Class<A> annotationType)
        Find the first annotation of annotationType that is either present or meta-present on the Parameter for this context.

        WARNING

        Favor the use of this method over directly invoking annotation lookup methods in the Parameter API due to a bug in javac on JDK versions prior to JDK 9.

        Type Parameters:
        A - the annotation type
        Parameters:
        annotationType - the annotation type to search for; never null
        Returns:
        an Optional containing the annotation; never null but potentially empty
        Since:
        5.1.1
        See Also:
        isAnnotated(Class), findRepeatableAnnotations(Class)
      • findRepeatableAnnotations

        <A extends AnnotationList<A> findRepeatableAnnotations​(Class<A> annotationType)
        Find all repeatable annotations of annotationType that are either present or meta-present on the Parameter for this context.

        WARNING

        Favor the use of this method over directly invoking annotation lookup methods in the Parameter API due to a bug in javac on JDK versions prior to JDK 9.

        Type Parameters:
        A - the annotation type
        Parameters:
        annotationType - the repeatable annotation type to search for; never null
        Returns:
        the list of all such annotations found; neither null nor mutable, but potentially empty
        Since:
        5.1.1
        See Also:
        isAnnotated(Class), findAnnotation(Class), Repeatable