FileDocCategorySizeDatePackage
PreDestroyHandler.javaAPI DocGlassfish v2 API4148Fri May 04 22:31:34 BST 2007com.sun.enterprise.deployment.annotation.handlers

PreDestroyHandler

public class PreDestroyHandler extends AbstractResourceHandler
This handler is responsible for handling javax.annotation.PreDestroy

Fields Summary
Constructors Summary
public PreDestroyHandler()

    
Methods Summary
public java.lang.ClassgetAnnotationType()

return
the annoation type this annotation handler is handling

        return PreDestroy.class;
    
protected com.sun.enterprise.deployment.annotation.HandlerProcessingResultprocessAnnotation(com.sun.enterprise.deployment.annotation.AnnotationInfo ainfo, com.sun.enterprise.deployment.annotation.context.ResourceContainerContext[] rcContexts)


        AnnotatedElementHandler aeHandler = ainfo.getProcessingContext().getHandler();
        PreDestroy preDestroyAn =
                (PreDestroy)ainfo.getAnnotation();
        Method annMethod = (Method)ainfo.getAnnotatedElement();
        String pdMethodName = annMethod.getName();
        String pdClassName = annMethod.getDeclaringClass().getName();

        for (ResourceContainerContext rcContext : rcContexts) {
            LifecycleCallbackDescriptor preDestroyDesc =
                   new LifecycleCallbackDescriptor();
            preDestroyDesc.setLifecycleCallbackClass(pdClassName);
            preDestroyDesc.setLifecycleCallbackMethod(pdMethodName);
            // override by xml is handled in addPreDestroyDescriptor
            rcContext.addPreDestroyDescriptor(preDestroyDesc);
        }

        return getDefaultProcessedResult();