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

PostConstructHandler

public class PostConstructHandler extends AbstractResourceHandler
This handler is responsible for handling javax.annotation.PostConstruct

Fields Summary
Constructors Summary
public PostConstructHandler()

    
Methods Summary
public java.lang.ClassgetAnnotationType()

return
the annoation type this annotation handler is handling

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


        PostConstruct postConstructAn =
                (PostConstruct)ainfo.getAnnotation();
        Method annMethod = (Method)ainfo.getAnnotatedElement();
        String pcMethodName = annMethod.getName();
        String pcClassName = annMethod.getDeclaringClass().getName();

        for (ResourceContainerContext rcContext : rcContexts) {
            LifecycleCallbackDescriptor postConstructDesc =
                   new LifecycleCallbackDescriptor();
            postConstructDesc.setLifecycleCallbackClass(pcClassName);
            postConstructDesc.setLifecycleCallbackMethod(pcMethodName);
            // override by xml is handled in addPostConstructDescriptor
            rcContext.addPostConstructDescriptor(postConstructDesc);
        }

        return getDefaultProcessedResult();