147148149150151152153154155156157
public static boolean hasAnnotation(CtClass ctClass, String annotation) throws ClassNotFoundException { for (Object object : ctClass.getAvailableAnnotations()) { Annotation ann = (Annotation) object; if (ann.annotationType().getName().equals(annotation)) { return true; } } return false; }
158159160161162163164165166167168
public static boolean hasAnnotationWithPrefix(CtClass ctClass, String annotationPrefix) throws ClassNotFoundException { for (Object object : ctClass.getAvailableAnnotations()) { Annotation ann = (Annotation) object; if (ann.annotationType().getName().startsWith(annotationPrefix)) { return true; } } return false; }
169170171172173174175176177178179
public static boolean hasAnnotation(CtField ctField, String annotation) throws ClassNotFoundException { for (Object object : ctField.getAvailableAnnotations()) { Annotation ann = (Annotation) object; if (ann.annotationType().getName().equals(annotation)) { return true; } } return false; }
179180181182183184185186187188189
} public static boolean hasAnnotation(CtMethod ctMethod, String annotation) throws ClassNotFoundException { for (Object object : ctMethod.getAvailableAnnotations()) { Annotation ann = (Annotation) object; if (ann.annotationType().getName().equals(annotation)) { return true; } } return false; }
850851852853854855856857858859860
if (a instanceof Named) { named = (Named)a; break; } else if (a.annotationType().isAnnotationPresent(Qualifier.class)) { qualifier = a.annotationType(); break; } }
852853854855856857858859860861862
named = (Named)a; break; } else if (a.annotationType().isAnnotationPresent(Qualifier.class)) { qualifier = a.annotationType(); break; } } if (type.isInterface() && type.equals(Provider.class)) {
106107108109110111112113114115116
if (!(other instanceof Annotation)) { return false; } Annotation otherAnnotation = (Annotation) other; if (annotationClass != otherAnnotation.annotationType()) { return false; } try { for (Method method : annotationClass.getDeclaredMethods()) {
129130131132133134135136137138139
if (annotationMetaData != null) { for (AnnotationMetaData annMeta : annotationMetaData) { Annotation ann = annMeta.getAnnotationInstance(); if (ann.annotationType() == InterceptMC.class) { interceptAnnotation = (InterceptMC) ann; } } }
955956957958959960961962963964965
} else { annotation = new PostConstructImpl(); } annotationClass = annotation.annotationType(); method.setMethodName("ejbCreate"); addAnnotations(annotationClass, annotation, container, method); } annotation = new PostActivateImpl();
104105106107108109110111112113114