Class AbstractHandler
- java.lang.Object
-
- com.sun.enterprise.deployment.annotation.handlers.AbstractHandler
-
- All Implemented Interfaces:
AnnotationHandler
- Direct Known Subclasses:
AbstractAttributeHandler,AbstractCommonAttributeHandler,AbstractEjbHandler,AbstractResourceHandler,ActivationHandler,AdministeredObjectHandler,ApplicationExceptionHandler,AuthenticationMechanismHandler,ConfigPropertyHandler,ConnectionDefinitionHandler,ConnectionDefinitionsHandler,ConnectorAnnotationHandler,HandlerChainHandler,ManagedBeanHandler,MultipartConfigHandler,SecurityPermissionHandler,ServletSecurityHandler,WebFilterHandler,WebListenerHandler,WebServiceHandler,WebServiceProviderHandler,WebServiceRefHandler,WebServletHandler
public abstract class AbstractHandler extends Object implements AnnotationHandler
This is an abstract base class for Handlers. Concrete subclass has to be annotated withAnnotationHandlerForso that appropriate metadata can be generated statically. Concrete subclass has to also implement the following method: public HandlerProcessingResult processAnnotation(AnnotationInfo ainfo)- Author:
- Shing Wai Chan
-
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationTypesProviderejbProviderprotected static LocalStringManagerImpllocalStringsprotected Loggerlogger-
Fields inherited from interface org.glassfish.apf.AnnotationHandler
ANNOTATION_HANDLER_METADATA
-
-
Constructor Summary
Constructors Constructor Description AbstractHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<? extends Annotation>getAnnotationType()protected Class<? extends Annotation>[]getConnectorAnnotationTypes()This is called by getTypeDependencies().protected HandlerProcessingResultgetDefaultFailedResult()protected HandlerProcessingResultgetDefaultProcessedResult()protected Class<? extends Annotation>[]getEjbAndWebAnnotationTypes()This is called by getTypeDependencies().protected Class<? extends Annotation>[]getEjbAnnotationTypes()This is called by getTypeDependencies().protected StringgetInjectionMethodPropertyName(Method method, AnnotationInfo ainfo)protected HandlerProcessingResultgetInvalidAnnotatedElementHandlerResult(AnnotatedElementHandler aeHandler, AnnotationInfo ainfo)protected HandlerProcessingResultgetOverallProcessingResult(List<HandlerProcessingResult> resultList)Returns the result with the highest result type where FAILED > PROCESSED > UNPROCESSEDClass<? extends Annotation>[]getTypeDependencies()protected Class<? extends Annotation>[]getWebAnnotationTypes()This is called by getTypeDependencies().protected voidlog(Level level, AnnotationInfo ainfo, String localizedMessage)Logs an error with the annotation processing loggerprotected voidvalidateInjectionMethod(Method method, AnnotationInfo ainfo)Check if given method is a valid injection method.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.glassfish.apf.AnnotationHandler
processAnnotation
-
-
-
-
Field Detail
-
localStrings
protected static final LocalStringManagerImpl localStrings
-
logger
protected Logger logger
-
ejbProvider
@Inject @Named("EJB") @Optional protected AnnotationTypesProvider ejbProvider
-
-
Method Detail
-
getAnnotationType
public final Class<? extends Annotation> getAnnotationType()
- Specified by:
getAnnotationTypein interfaceAnnotationHandler- Returns:
- the annotation type this annotation handler is handling
-
getTypeDependencies
public Class<? extends Annotation>[] getTypeDependencies()
- Specified by:
getTypeDependenciesin interfaceAnnotationHandler- Returns:
- an array of annotation types this annotation handler would require to be processed (if present) before it processes it's own annotation type.
-
getDefaultProcessedResult
protected HandlerProcessingResult getDefaultProcessedResult()
- Returns:
- a default processed result
-
getDefaultFailedResult
protected HandlerProcessingResult getDefaultFailedResult()
- Returns:
- a default failed result
-
getInvalidAnnotatedElementHandlerResult
protected HandlerProcessingResult getInvalidAnnotatedElementHandlerResult(AnnotatedElementHandler aeHandler, AnnotationInfo ainfo) throws AnnotationProcessorException
- Parameters:
aeHandler-ainfo-- Returns:
- a result for invalid AnnotatedElementHandler
- Throws:
AnnotationProcessorException
-
log
protected void log(Level level, AnnotationInfo ainfo, String localizedMessage) throws AnnotationProcessorException
Logs an error with the annotation processing logger- Parameters:
level-ainfo-localizedMessage-- Throws:
AnnotationProcessorException
-
getInjectionMethodPropertyName
protected String getInjectionMethodPropertyName(Method method, AnnotationInfo ainfo) throws AnnotationProcessorException
- Throws:
AnnotationProcessorException
-
validateInjectionMethod
protected void validateInjectionMethod(Method method, AnnotationInfo ainfo) throws AnnotationProcessorException
Check if given method is a valid injection method. Throw Exception if it is not.- Throws:
AnnotationProcessorException
-
getOverallProcessingResult
protected HandlerProcessingResult getOverallProcessingResult(List<HandlerProcessingResult> resultList)
Returns the result with the highest result type where FAILED > PROCESSED > UNPROCESSED- Parameters:
resultList-- Returns:
-
getEjbAnnotationTypes
protected Class<? extends Annotation>[] getEjbAnnotationTypes()
This is called by getTypeDependencies().- Returns:
- an array of all ejb annotation types
-
getEjbAndWebAnnotationTypes
protected Class<? extends Annotation>[] getEjbAndWebAnnotationTypes()
This is called by getTypeDependencies().- Returns:
- an array of all ejb and web types annotation
-
getWebAnnotationTypes
protected Class<? extends Annotation>[] getWebAnnotationTypes()
This is called by getTypeDependencies().- Returns:
- an array of all web types annotation
-
getConnectorAnnotationTypes
protected Class<? extends Annotation>[] getConnectorAnnotationTypes()
This is called by getTypeDependencies().- Returns:
- an array of all connector type annotations
-
-