/** * Searches for an annotation starting at the specified class and working backwards. * Searching stops when the annotation is found. * * @param clazz * @param annotationClass * @return */ private <A extends Annotation> A getInheritableAnnotation(Class clazz, Class<A> annotationClass) { if (clazz == null || clazz.equals(Object.class)) return null; Annotation annotation = clazz.getAnnotation(annotationClass); if (annotation != null) { return (A) annotation; } return getInheritableAnnotation(clazz.getSuperclass(), annotationClass); }
/** * Searches for an annotation starting at the specified class and working backwards. * Searching stops when the annotation is found. * * @param clazz * @param annotationClass * @return */ private <A extends Annotation> A getInheritableAnnotation(final Class clazz, final Class<A> annotationClass) { if (clazz == null || clazz.equals(Object.class)) { return null; } final MetaAnnotatedClass meta = new MetaAnnotatedClass(clazz); final Annotation annotation = meta.getAnnotation(annotationClass); if (annotation != null) { return (A) annotation; } return getInheritableAnnotation(clazz.getSuperclass(), annotationClass); }
/** * Searches for an annotation starting at the specified class and working backwards. * Searching stops when the annotation is found. * * @param clazz * @param annotationClass * @return */ private <A extends Annotation> A getInheritableAnnotation(final Class clazz, final Class<A> annotationClass) { if (clazz == null || clazz.equals(Object.class)) { return null; } final MetaAnnotatedClass meta = new MetaAnnotatedClass(clazz); final Annotation annotation = meta.getAnnotation(annotationClass); if (annotation != null) { return (A) annotation; } return getInheritableAnnotation(clazz.getSuperclass(), annotationClass); }
TransactionManagement tx = getInheritableAnnotation(clazz, TransactionManagement.class); TransactionManagementType transactionType = TransactionManagementType.CONTAINER; if (tx != null) { RemoteHome remoteHome = getInheritableAnnotation(clazz, RemoteHome.class); if (remoteHome != null) { Class<?> homeClass = remoteHome.value(); LocalHome localHome = getInheritableAnnotation(clazz, LocalHome.class); if (localHome != null) { Class<?> homeClass = localHome.value(); ConcurrencyManagement tx = getInheritableAnnotation(clazz, ConcurrencyManagement.class); ConcurrencyManagementType concurrencyType = ConcurrencyManagementType.CONTAINER; if (tx != null) { Startup startup = getInheritableAnnotation(clazz, Startup.class); sessionBean.setLoadOnStartup(startup != null); DependsOn dependsOn = getInheritableAnnotation(clazz, DependsOn.class); if (dependsOn != null) { sessionBean.setDependsOn(dependsOn.value());
final TransactionManagement tx = getInheritableAnnotation(clazz, TransactionManagement.class); TransactionManagementType transactionType = TransactionManagementType.CONTAINER; if (tx != null) { final RemoteHome remoteHome = getInheritableAnnotation(clazz, RemoteHome.class); if (remoteHome != null) { final Class<?> homeClass = remoteHome.value(); final LocalHome localHome = getInheritableAnnotation(clazz, LocalHome.class); if (localHome != null) { final Class<?> homeClass = localHome.value(); final DependsOn dependsOn = getInheritableAnnotation(clazz, DependsOn.class); if (dependsOn != null) { sessionBean.setDependsOn(dependsOn.value()); final ConcurrencyManagement tx = getInheritableAnnotation(clazz, ConcurrencyManagement.class); javax.ejb.ConcurrencyManagementType concurrencyType = javax.ejb.ConcurrencyManagementType.CONTAINER; if (tx != null) { final Startup startup = getInheritableAnnotation(clazz, Startup.class); sessionBean.setInitOnStartup(startup != null); final StatefulTimeout annotation = getInheritableAnnotation(clazz, StatefulTimeout.class); if (annotation != null) { final Timeout timeout = new Timeout();
final TransactionManagement tx = getInheritableAnnotation(clazz, TransactionManagement.class); TransactionManagementType transactionType = TransactionManagementType.CONTAINER; if (tx != null) { final RemoteHome remoteHome = getInheritableAnnotation(clazz, RemoteHome.class); if (remoteHome != null) { final Class<?> homeClass = remoteHome.value(); final LocalHome localHome = getInheritableAnnotation(clazz, LocalHome.class); if (localHome != null) { final Class<?> homeClass = localHome.value(); final DependsOn dependsOn = getInheritableAnnotation(clazz, DependsOn.class); if (dependsOn != null) { sessionBean.setDependsOn(dependsOn.value()); final ConcurrencyManagement tx = getInheritableAnnotation(clazz, ConcurrencyManagement.class); javax.ejb.ConcurrencyManagementType concurrencyType = javax.ejb.ConcurrencyManagementType.CONTAINER; if (tx != null) { final Startup startup = getInheritableAnnotation(clazz, Startup.class); sessionBean.setInitOnStartup(startup != null); final StatefulTimeout annotation = getInheritableAnnotation(clazz, StatefulTimeout.class); if (annotation != null) { final Timeout timeout = new Timeout();