// For Bean only
if (this.classAnnotationMetadata.isBean()) {
// Add default lifecycle methods. These methods will call defined
// lifecycle callback method and super methods or will do nothing.
EasyBeansEjbJarMethodMetadata posConsMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, POST_CONSTRUCT);
EasyBeansEjbJarMethodMetadata preDesMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, PRE_DESTROY);
EasyBeansEjbJarMethodMetadata postActMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, POST_ACTIVATE);
EasyBeansEjbJarMethodMetadata prePassMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, PRE_PASSIVATE);
// Generate class for dependency injection
generateClass(
new EasyBeansEjbJarMethodMetadata(InjectionClassAdapter.INJECTED_JMETHOD, this.classAnnotationMetadata),
DEP_INJECT);
// Generate class for timer
// Create the method by cloning the existing timer method
EasyBeansEjbJarMethodMetadata timerMethodAnnotationMetadata = null;
for (EasyBeansEjbJarMethodMetadata m : this.classAnnotationMetadata.getMethodMetadataCollection()) {
// Found the timer method ?
if (m.isTimeout()) {
// clone this method (to get the correct interceptors, etc)
timerMethodAnnotationMetadata = (EasyBeansEjbJarMethodMetadata) m.clone();
// Change the method name to the generated method
timerMethodAnnotationMetadata.setJMethod(BeanClassAdapter.TIMER_JMETHOD);
// set the class
timerMethodAnnotationMetadata.setClassMetadata(this.classAnnotationMetadata);
// It is not inherited as it's build on this class level
timerMethodAnnotationMetadata.setInherited(false, null);
break;
}
}
// build an empty one if not built just before
if (timerMethodAnnotationMetadata == null) {
timerMethodAnnotationMetadata = new EasyBeansEjbJarMethodMetadata(BeanClassAdapter.TIMER_JMETHOD,
this.classAnnotationMetadata);
}
// Generate the class
generateClass(timerMethodAnnotationMetadata, TIMED_OBJECT);