public class ResourceInspector extends Object
Constructor and Description |
---|
ResourceInspector() |
Modifier and Type | Method and Description |
---|---|
static Map<String,org.alfresco.util.Pair<String,Method>> |
findEmbeddedResources(Class<?> anyClass)
For a given class, looks for @EmbeddedEntityResource annotations, using the annotation produce
a Map of the property name key and the entity key
|
static String |
findEntityCollectionNameName(ResourceMetadata meta)
Finds the name of the entity collection using the meta information.
|
protected static String |
findEntityName(EntityResource entityAnnot)
Finds the name of the entity using its annotation.
|
protected static String |
findEntityNameByAnnotationAttributes(Map<String,Object> annotAttribs)
Finds the name of the entity using its annotation.
|
static Method |
findMethod(Class<? extends ResourceAction> resourceInterfaceWithOneMethod,
Class<?> resource)
Returns the method for the interface
|
static String |
findUniqueId(Object obj)
Finds the unique id of an object using the @UniqueId annotation.
|
static Method |
findUniqueIdMethod(Class<?> objClass)
Finds a single method with the @UniqueId annotation.
|
static String |
findUniqueIdName(Method uniqueIdMethod)
Finds the property name that is used as the unique id.
|
static List<ResourceMetadata> |
inspect(Class resource)
Inspects the annotated resource to understand its capabilities
|
static void |
inspectAddressedProperties(Api api,
Class<?> resource,
String entityPath,
List<ResourceMetadata> metainfo)
Inspects the entity resource and returns meta data about any addresssed/binary properties
|
static Api |
inspectApi(Class<?> resource)
Inspects the resource to determine what api it belongs to.
|
static ResourceOperation |
inspectOperation(Class<?> resource,
Method aMethod,
org.springframework.http.HttpMethod httpMethod)
Inspects the method and returns meta data about its operations
|
static void |
inspectOperations(Api api,
Class<?> resource,
String entityPath,
List<ResourceMetadata> metainfo)
Inspect a resource to find operations on it.
|
static boolean |
isDeleted(Method method)
Returns true if the method has been marked as deleted.
|
static boolean |
isNoAuth(Method method)
Returns true if the method has been marked as no auth required.
|
static int |
validSuccessCode(org.springframework.http.HttpMethod httpMethod,
int success) |
public static void inspectAddressedProperties(Api api, Class<?> resource, String entityPath, List<ResourceMetadata> metainfo)
api
- ApientityPath
- Stringpublic static ResourceOperation inspectOperation(Class<?> resource, Method aMethod, org.springframework.http.HttpMethod httpMethod)
aMethod
- MethodhttpMethod
- HttpMethodpublic static int validSuccessCode(org.springframework.http.HttpMethod httpMethod, int success)
public static boolean isDeleted(Method method)
method
- the methodpublic static boolean isNoAuth(Method method)
method
- the methodpublic static Method findMethod(Class<? extends ResourceAction> resourceInterfaceWithOneMethod, Class<?> resource)
protected static String findEntityNameByAnnotationAttributes(Map<String,Object> annotAttribs)
protected static String findEntityName(EntityResource entityAnnot)
entityAnnot
- EntityResourcepublic static String findEntityCollectionNameName(ResourceMetadata meta)
meta
- ResourceMetadatapublic static Map<String,org.alfresco.util.Pair<String,Method>> findEmbeddedResources(Class<?> anyClass)
public static void inspectOperations(Api api, Class<?> resource, String entityPath, List<ResourceMetadata> metainfo)
api
- ApientityPath
- Stringmetainfo
- resource metadatapublic static Api inspectApi(Class<?> resource)
public static List<ResourceMetadata> inspect(Class resource)
resource
- Classpublic static String findUniqueId(Object obj)
obj
- any objectpublic static Method findUniqueIdMethod(Class<?> objClass) throws IllegalArgumentException
objClass
- any object classIllegalArgumentException
- if there is is more than 1 method annotated with @UniqueIdCopyright © 2005–2017 Alfresco Software. All rights reserved.