if (next.getCallbackDescriptors(type).size() > 0) {
callbackInterceptors.add(next);
}
}
EjbInterceptor beanClassCallbackInfo = null;
switch (type) {
case POST_CONSTRUCT:
if (hasPostConstructMethod()) {
beanClassCallbackInfo = new EjbInterceptor();
beanClassCallbackInfo.setFromBeanClass(true);
beanClassCallbackInfo.addCallbackDescriptors
(type, getPostConstructDescriptors());
}
break;
case PRE_DESTROY:
if (hasPreDestroyMethod()) {
beanClassCallbackInfo = new EjbInterceptor();
beanClassCallbackInfo.setFromBeanClass(true);
beanClassCallbackInfo.addCallbackDescriptors
(type, getPreDestroyDescriptors());
}
break;
case PRE_PASSIVATE:
if (((EjbSessionDescriptor) this).hasPrePassivateMethod()) {
beanClassCallbackInfo = new EjbInterceptor();
beanClassCallbackInfo.setFromBeanClass(true);
beanClassCallbackInfo.addCallbackDescriptors(type,
((EjbSessionDescriptor) this).getPrePassivateDescriptors());
}
break;
case POST_ACTIVATE:
if (((EjbSessionDescriptor) this).hasPostActivateMethod()) {
beanClassCallbackInfo = new EjbInterceptor();
beanClassCallbackInfo.setFromBeanClass(true);
beanClassCallbackInfo.addCallbackDescriptors(type,
((EjbSessionDescriptor) this).getPostActivateDescriptors());
}
break;
default:
throw new IllegalStateException(localStrings.getLocalString(
"enterprise.deployment.invalidcallbacktype",
"Invalid callback type: [{0}]", type));
}
if (beanClassCallbackInfo != null) {
beanClassCallbackInfo.setInterceptorClassName
(getEjbImplClassName());
callbackInterceptors.add(beanClassCallbackInfo);
}