public void postProcessAnnotation(AnnotationInfo ainfo, EjbContext ejbContext)
throws AnnotationProcessorException {
EjbSessionDescriptor ejbDesc = (EjbSessionDescriptor) ejbContext.getDescriptor();
Class classAn = (Class)ainfo.getAnnotatedElement();
Lock lockAnn = (Lock) ainfo.getAnnotation();
// At this point, all method-level specific annotations have been processed.
// For non-private methods, find the ones from the EjbContext's
// component definition view that are declared on this class. This will correctly
// eliminate any overridden methods and provide the most-derived version of each.
// Use the Class's declared methods list to get the private methods.
List<Method> toProcess = new ArrayList<Method>();
for(Method m : ejbContext.getComponentDefinitionMethods()) {
if( classAn.equals(m.getDeclaringClass())) {
toProcess.add(m);
}
}
for(Method m : classAn.getDeclaredMethods()) {
if( Modifier.isPrivate(m.getModifiers()) ) {
toProcess.add(m);
}
}
for( Method m : toProcess ) {
// If the method is declared on the same class as the TYPE-level default
// and it hasn't already been assigned lock information from the deployment
// descriptor, set it.
if( !matchesExistingReadOrWriteLockMethod(m, ejbDesc) ) {
MethodDescriptor newMethodDesc = new MethodDescriptor(m);
if( lockAnn.value() == LockType.WRITE) {
ejbDesc.addWriteLockMethod(newMethodDesc);
} else {
ejbDesc.addReadLockMethod(newMethodDesc);
}
}