Package io.milton.http.annotated
Class AbstractAnnotationHandler
java.lang.Object
io.milton.http.annotated.AbstractAnnotationHandler
- All Implemented Interfaces:
AnnotationHandler
- Direct Known Subclasses:
AccessControlListAnnotationHandler,AddressBooksAnnotationHandler,AuthenticateAnnotationHandler,CalendarDateRangeQueryAnnotationHandler,CalendarInvitationsAnnotationHandler,CalendarInvitationsCTagAnnotationHandler,CalendarsAnnotationHandler,ChildOfAnnotationHandler,ChildrenOfAnnotationHandler,CommonPropertyAnnotationHandler,ContactDataAnnotationHandler,ContentTypeAnnotationHandler,CopyAnnotationHandler,CTagAnnotationHandler,DeleteAnnotationHandler,DisplayNameAnnotationHandler,DisplayNameSetterAnnotationHandler,FreeBusyQueryAnnotationHandler,GetAnnotationHandler,ICalDataAnnotationHandler,MakeCalendarAnnotationHandler,MakeCollectionAnnotationHandler,MoveAnnotationHandler,PostAnnotationHandler,PrincipalSearchAnnotationHandler,PutChildAnnotationHandler,UsersAnnotationHandler
- Author:
- brad
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Classprotected final AnnotationResourceFactoryprotected final Request.Method[] -
Constructor Summary
ConstructorsConstructorDescriptionAbstractAnnotationHandler(AnnotationResourceFactory outer, Class annoClass, Request.Method... methods) -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectattemptToReadProperty(Object source, String... propNames) protected booleanattemptToSetProperty(Object source, Object value, String... propNames) Returns true if it was able to set the propertyGet the annotation class that this handler handlesList the methods found when parsing annotations on the controllergetMethodForType(AnnoCollectionResource parent, String type) Locate a ControllerMethod which can create an object of the given type (may be null) in the given parentReturn any HTTP methods which this annotation handler supportsprotected Objectinvoke(ControllerMethod cm, AnnoResource sourceRes, Object... values) booleanisCompatible(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 typevoidparseController(Object controller) Called on initialisation, the handler should look for annotations on the controller object and prepare itself to use them
-
Field Details
-
annoResourceFactory
-
annoClass
-
methods
-
-
Constructor Details
-
AbstractAnnotationHandler
public AbstractAnnotationHandler(AnnotationResourceFactory outer, Class annoClass, Request.Method... methods)
-
-
Method Details
-
getAnnoClass
Description copied from interface:AnnotationHandlerGet the annotation class that this handler handles- Specified by:
getAnnoClassin interfaceAnnotationHandler- Returns:
-
parseController
Description copied from interface:AnnotationHandlerCalled on initialisation, the handler should look for annotations on the controller object and prepare itself to use them- Specified by:
parseControllerin interfaceAnnotationHandler
-
getMethodForType
Locate a ControllerMethod which can create an object of the given type (may be null) in the given parent- Parameters:
parent-type- - final segment of the class name to be created, or null. Eg to create com.mycompany.Customer use "Customer"- Returns:
- null, if none found, otherwise a method which can create the given resource
-
getSupportedMethods
Description copied from interface:AnnotationHandlerReturn any HTTP methods which this annotation handler supports- Specified by:
getSupportedMethodsin interfaceAnnotationHandler- Returns:
-
isCompatible
Description copied from interface:AnnotationHandlerDetermine 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- Specified by:
isCompatiblein interfaceAnnotationHandler- Returns:
-
attemptToReadProperty
protected Object attemptToReadProperty(Object source, String... propNames) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException -
attemptToSetProperty
protected boolean attemptToSetProperty(Object source, Object value, String... propNames) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException Returns true if it was able to set the property- Parameters:
source-value-propNames-- Returns:
- Throws:
IllegalAccessExceptionInvocationTargetExceptionNoSuchMethodException
-
invoke
protected Object invoke(ControllerMethod cm, AnnoResource sourceRes, Object... values) throws Exception - Throws:
Exception
-
getControllerMethods
Description copied from interface:AnnotationHandlerList the methods found when parsing annotations on the controller- Specified by:
getControllerMethodsin interfaceAnnotationHandler- Returns:
-