Class MethodAnnotationScanner.MethodInfo

java.lang.Object
org.dellroad.stuff.java.MethodAnnotationScanner.MethodInfo
Enclosing class:
MethodAnnotationScanner<T,A extends Annotation>

public class MethodAnnotationScanner.MethodInfo extends Object
Holds information about an annotated method detected by a MethodAnnotationScanner.
See Also:
  • Constructor Details

    • MethodInfo

      public MethodInfo(Method method, A annotation)
  • Method Details

    • getMethod

      public Method getMethod()
      Get the annotated method.
      Returns:
      annotated method taking zero parameters and returning non-void
    • getAnnotation

      public A getAnnotation()
      Get the method annotation.
      Returns:
      annotation found on the method
    • getMethodPropertyName

      public String getMethodPropertyName()
      Get the Java bean property name implied by the associated method, if any.
      Returns:
      the name of the bean property implied by the method
      Throws:
      IllegalArgumentException - if the method does not follow Java bean conventions
    • invoke

      public Object invoke(T obj, Object... params)
      Invoke the method and return the result. Any checked exception thrown is rethrown after being wrapped in a RuntimeException.
      Parameters:
      obj - instance on which to invoke the method; may be null for static methods
      params - method parameters
      Returns:
      result of invoking method
      Throws:
      RuntimeException - if invocation fails
    • getSetter

      public Method getSetter()
      Assuming this instance's annotated method is a getter method, find the corresponding setter method if it exists.
      Returns:
      corresponding public setter method, or null if none exists
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object