Class ResourceInspectorUtil

java.lang.Object
org.alfresco.rest.framework.core.ResourceInspectorUtil

public class ResourceInspectorUtil extends Object
Generic methods used by ResourceInspector
Author:
Gethin James
  • Constructor Details

    • ResourceInspectorUtil

      public ResourceInspectorUtil()
  • Method Details

    • determineType

      protected static Class determineType(Class resource, Method method)
      Determine the expected type as the returned type of the method. If the return type is a List it will return the generic element type instead of a List.
      Parameters:
      resource - - resource with methods
      method - Method
      Returns:
      Class - type of class it needs.
    • determineOperationType

      protected static Class determineOperationType(Class resource, Method method)
    • findMethodsByAnnotation

      public static List<Method> findMethodsByAnnotation(Class objClass, Class<? extends Annotation> annotationType)
      Finds methods for the given annotation It first finds all public member methods of the class or interface represented by objClass, including those inherited from superclasses and superinterfaces. It then loops through these methods searching for a single Annotation of annotationType, traversing its super methods if no annotation can be found on the given method itself.
      Parameters:
      objClass - - the class
      annotationType - - the annotation to find
      Returns:
      - the List of Method or an empty List
    • invokeMethod

      public static Object invokeMethod(Method annotatedMethod, Object obj)
      Invokes a no arg method and returns the result
      Parameters:
      annotatedMethod - Method
      obj - Object
      Returns:
      result of method call
    • invokeMethod

      public static Object invokeMethod(Method annotatedMethod, Object obj, Object... args) throws Throwable
      Invokes a method and returns the result
      Parameters:
      annotatedMethod - Method
      obj - Object
      Returns:
      result of method call
      Throws:
      Throwable