Package org.alfresco.rest.framework.core
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 Summary
Constructors Constructor Description ResourceInspectorUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static Class
determineOperationType(Class resource, Method method)
protected static Class
determineType(Class resource, Method method)
Determine the expected type as the returned type of the method.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.static Object
invokeMethod(Method annotatedMethod, Object obj)
Invokes a no arg method and returns the resultstatic Object
invokeMethod(Method annotatedMethod, Object obj, Object... args)
Invokes a method and returns the result
-
-
-
Method Detail
-
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 methodsmethod
- 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 classannotationType
- - 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
- Methodobj
- Object- Returns:
- result of method call
-
-