public abstract class AbstractAnnotationHandler extends Object implements AnnotationHandler
| Modifier and Type | Field and Description |
|---|---|
protected Class |
annoClass |
protected AnnotationResourceFactory |
annoResourceFactory |
protected Request.Method[] |
methods |
| Constructor and Description |
|---|
AbstractAnnotationHandler(AnnotationResourceFactory outer,
Class annoClass,
Request.Method... methods) |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
attemptToReadProperty(Object source,
String... propNames) |
protected boolean |
attemptToSetProperty(Object source,
Object value,
String... propNames)
Returns true if it was able to set the property
|
Class |
getAnnoClass()
Get the annotation class that this handler handles
|
List<ControllerMethod> |
getControllerMethods()
List the methods found when parsing annotations on the controller
|
ControllerMethod |
getMethodForType(AnnoCollectionResource parent,
String type)
Locate a ControllerMethod which can create an object of the given type
(may be null) in the given parent
|
Request.Method[] |
getSupportedMethods()
Return any HTTP methods which this annotation handler supports
|
protected Object |
invoke(ControllerMethod cm,
AnnoResource sourceRes,
Object... values) |
boolean |
isCompatible(Object source)
Determine if this handler is able to support the given source object, ie
if there is a controller method registered in this handler that supports
the given source type
|
void |
parseController(Object controller)
Called on initialisation, the handler should look for annotations on the
controller object and prepare itself to use them
|
protected final AnnotationResourceFactory annoResourceFactory
protected final Class annoClass
protected final Request.Method[] methods
public AbstractAnnotationHandler(AnnotationResourceFactory outer, Class annoClass, Request.Method... methods)
public Class getAnnoClass()
AnnotationHandlergetAnnoClass in interface AnnotationHandlerpublic void parseController(Object controller)
AnnotationHandlerparseController in interface AnnotationHandlerpublic ControllerMethod getMethodForType(AnnoCollectionResource parent, String type)
parent - type - - final segment of the class name to be created, or null. Eg
to create com.mycompany.Customer use "Customer"public Request.Method[] getSupportedMethods()
AnnotationHandlergetSupportedMethods in interface AnnotationHandlerpublic boolean isCompatible(Object source)
AnnotationHandlerisCompatible in interface AnnotationHandlerprotected Object attemptToReadProperty(Object source, String... propNames) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
protected boolean attemptToSetProperty(Object source, Object value, String... propNames) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
source - value - propNames - IllegalAccessExceptionInvocationTargetExceptionNoSuchMethodExceptionprotected Object invoke(ControllerMethod cm, AnnoResource sourceRes, Object... values) throws Exception
Exceptionpublic List<ControllerMethod> getControllerMethods()
AnnotationHandlergetControllerMethods in interface AnnotationHandlerCopyright © 2021 McEvoy Software Ltd. All rights reserved.