Class ReflectionHintsPredicates

java.lang.Object
org.springframework.aot.hint.predicate.ReflectionHintsPredicates

public class ReflectionHintsPredicates extends Object
Generator of ReflectionHints predicates, testing whether the given hints match the expected behavior for reflection.
Since:
6.0
Author:
Brian Clozel, Stephane Nicoll
  • Method Details

    • onType

      Return a predicate that checks whether a reflection hint is registered for the given type.

      The returned type exposes additional methods that refine the predicate behavior.

      Parameters:
      typeReference - the type
      Returns:
      the RuntimeHints predicate
    • onType

      Return a predicate that checks whether a reflection hint is registered for the given type.

      The returned type exposes additional methods that refine the predicate behavior.

      Parameters:
      type - the type
      Returns:
      the RuntimeHints predicate
    • onConstructor

      Deprecated, for removal: This API element is subject to removal in a future version.
      Return a predicate that checks whether a reflection hint is registered for the given constructor. By default, both introspection and invocation hints match.

      The returned type exposes additional methods that refine the predicate behavior.

      Parameters:
      constructor - the constructor
      Returns:
      the RuntimeHints predicate
    • onConstructorInvocation

      public Predicate<RuntimeHints> onConstructorInvocation(Constructor<?> constructor)
      Return a predicate that checks whether an invocation hint is registered for the given constructor.
      Parameters:
      constructor - the constructor
      Returns:
      the RuntimeHints predicate
      Since:
      7.0
    • onMethod

      Deprecated, for removal: This API element is subject to removal in a future version.
      since 7.0 in favor of onMethodInvocation(Method) or onType(Class).
      Return a predicate that checks whether a reflection hint is registered for the given method. By default, both introspection and invocation hints match.

      The returned type exposes additional methods that refine the predicate behavior.

      Parameters:
      method - the method
      Returns:
      the RuntimeHints predicate
    • onMethodInvocation

      public Predicate<RuntimeHints> onMethodInvocation(Method method)
      Return a predicate that checks whether an invocation hint is registered for the given method.
      Parameters:
      method - the method
      Returns:
      the RuntimeHints predicate
      Since:
      7.0
    • onMethod

      @Deprecated(since="7.0", forRemoval=true) public ReflectionHintsPredicates.MethodHintPredicate onMethod(Class<?> type, String methodName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return a predicate that checks whether a reflection hint is registered for the method that matches the given selector. This looks up a method on the given type with the expected name, if unique. By default, both introspection and invocation hints match.

      The returned type exposes additional methods that refine the predicate behavior.

      Parameters:
      type - the type holding the method
      methodName - the method name
      Returns:
      the RuntimeHints predicate
      Throws:
      IllegalArgumentException - if the method cannot be found or if multiple methods are found with the same name.
    • onMethodInvocation

      public Predicate<RuntimeHints> onMethodInvocation(Class<?> type, String methodName)
      Return a predicate that checks whether an invocation hint is registered for the method that matches the given selector. This looks up a method on the given type with the expected name, if unique.
      Parameters:
      type - the type holding the method
      methodName - the method name
      Returns:
      the RuntimeHints predicate
      Throws:
      IllegalArgumentException - if the method cannot be found or if multiple methods are found with the same name.
      Since:
      7.0
    • onMethod

      Deprecated, for removal: This API element is subject to removal in a future version.
      Return a predicate that checks whether a reflection hint is registered for the method that matches the given selector. This looks up a method on the given type with the expected name, if unique. By default, both introspection and invocation hints match.

      The returned type exposes additional methods that refine the predicate behavior.

      Parameters:
      className - the name of the class holding the method
      methodName - the method name
      Returns:
      the RuntimeHints predicate
      Throws:
      ClassNotFoundException - if the class cannot be resolved.
      IllegalArgumentException - if the method cannot be found or if multiple methods are found with the same name.
    • onMethodInvocation

      public Predicate<RuntimeHints> onMethodInvocation(String className, String methodName) throws ClassNotFoundException
      Return a predicate that checks whether an invocation hint is registered for the method that matches the given selector. This looks up a method on the given type with the expected name, if unique.
      Parameters:
      className - the name of the class holding the method
      methodName - the method name
      Returns:
      the RuntimeHints predicate
      Throws:
      ClassNotFoundException - if the class cannot be resolved.
      IllegalArgumentException - if the method cannot be found or if multiple methods are found with the same name.
      Since:
      7.0
    • onField

      @Deprecated(since="7.0", forRemoval=true) public Predicate<RuntimeHints> onField(Class<?> type, String fieldName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 7.0 in favor of onFieldAccess(Class, String) with similar semantics.
      Return a predicate that checks whether a reflective field access hint is registered for the field. This looks up a field on the given type with the expected name, if present.
      Parameters:
      type - the type holding the field
      fieldName - the field name
      Returns:
      the RuntimeHints predicate
      Throws:
      IllegalArgumentException - if a field cannot be found with the given name.
    • onFieldAccess

      public Predicate<RuntimeHints> onFieldAccess(Class<?> type, String fieldName)
      Return a predicate that checks whether a reflective field access hint is registered for the field. This looks up a field on the given type with the expected name, if present.
      Parameters:
      type - the type holding the field
      fieldName - the field name
      Returns:
      the RuntimeHints predicate
      Throws:
      IllegalArgumentException - if a field cannot be found with the given name.
      Since:
      7.0
    • onField

      @Deprecated(since="7.0", forRemoval=true) public Predicate<RuntimeHints> onField(String className, String fieldName) throws ClassNotFoundException
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 7.0 in favor of onFieldAccess(String, String) with similar semantics.
      Return a predicate that checks whether a reflective field access hint is registered for the field. This looks up a field on the given type with the expected name, if present.
      Parameters:
      className - the name of the class holding the field
      fieldName - the field name
      Returns:
      the RuntimeHints predicate
      Throws:
      ClassNotFoundException - if the class cannot be resolved.
      IllegalArgumentException - if a field cannot be found with the given name.
    • onFieldAccess

      public Predicate<RuntimeHints> onFieldAccess(String className, String fieldName) throws ClassNotFoundException
      Return a predicate that checks whether an invocation hint is registered for the field. This looks up a field on the given type with the expected name, if present.
      Parameters:
      className - the name of the class holding the field
      fieldName - the field name
      Returns:
      the RuntimeHints predicate
      Throws:
      ClassNotFoundException - if the class cannot be resolved.
      IllegalArgumentException - if a field cannot be found with the given name.
      Since:
      7.0
    • onField

      @Deprecated(since="7.0", forRemoval=true) public Predicate<RuntimeHints> onField(Field field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 7.0 in favor of onFieldAccess(Field) with similar semantics.
      Return a predicate that checks whether a reflective field access hint is registered for the given field.
      Parameters:
      field - the field
      Returns:
      the RuntimeHints predicate
    • onFieldAccess

      public Predicate<RuntimeHints> onFieldAccess(Field field)
      Return a predicate that checks whether an invocation hint is registered for the given field.
      Parameters:
      field - the field
      Returns:
      the RuntimeHints predicate
      Since:
      7.0