/** * Finds annotation in class info. Returns <code>null</code> if annotation doesn't exist. */ default AnnotationInfo getAnnotation(final Class<? extends Annotation> an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return null; } String anName = an.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return ann; } } return null; }
/** * Returns <code>true</code> if method is annotated with provided annotation. */ default AnnotationInfo getAnnotation(final Class<? extends Annotation> an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return null; } String anName = an.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return ann; } } return null; }
/** * Returns <code>true</code> if method is annotated with one of provided annotation. */ default boolean hasAnnotation(final Class<? extends Annotation>... an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return false; } for (Class<? extends Annotation> annotationClass : an) { String anName = annotationClass.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return true; } } } return false; }
/** * Returns <code>true</code> if class is annotated with one of provided annotation. */ default boolean hasAnnotation(final Class<? extends Annotation>... an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return false; } for (Class<? extends Annotation> annotationClass : an) { String anName = annotationClass.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return true; } } } return false; }
String annotationClass = ann.getAnnotationClassname(); String annotationClass = ann.getAnnotationClassname();
@Test void testMethodSignature10() throws IOException { MethodInfo msv = getMethodSignatureForSingleMethod(M10.class); assertEquals(2, msv.getArgumentsCount()); assertEquals(0, msv.getArgument(1).getAnnotations().length); assertEquals(1, msv.getArgument(2).getAnnotations().length); assertEquals("jodd.proxetta.fixtures.data.FooAnn", msv.getArgument(2).getAnnotations()[0].getAnnotationClassname()); assertEquals("macka", msv.getMethodName()); assertEquals(1, msv.getAnnotations().length); assertEquals("jodd.proxetta.fixtures.data.FooAnn", msv.getAnnotations()[0].getAnnotationClassname()); }
AnnotationInfo ai = anns[0]; assertSame(ai, ci.getAnnotation(MadvocAction.class)); assertEquals(MadvocAction.class.getName(), ai.getAnnotationClassname()); assertEquals("L" + MadvocAction.class.getName().replace('.', '/') + ";", ai.getAnnotationSignature()); assertEquals("madvocAction", ai.getElement("value")); ai = anns[1]; assertSame(ai, ci.getAnnotation(PetiteBean.class)); assertEquals(PetiteBean.class.getName(), ai.getAnnotationClassname()); assertEquals("L" + PetiteBean.class.getName().replace('.', '/') + ";", ai.getAnnotationSignature()); ai = anns[2]; assertSame(ai, ci.getAnnotation(InterceptedBy.class)); assertEquals(InterceptedBy.class.getName(), ai.getAnnotationClassname()); assertEquals("L" + InterceptedBy.class.getName().replace('.', '/') + ";", ai.getAnnotationSignature()); assertTrue(ai.getElement("value") instanceof Object[]); assertEquals(Action.class.getName(), ai.getAnnotationClassname()); assertEquals("value", ai.getElement("value")); assertEquals("alias", ai.getElement("alias")); assertEquals(PetiteInject.class.getName(), ai.getAnnotationClassname()); assertEquals(0, ai.getElementNames().size()); assertEquals(Transaction.class.getName(), ai.getAnnotationClassname()); assertEquals(2, ai.getElementNames().size()); String s = (String) ai.getElement("propagation"); assertEquals(Action.class.getName(), ai.getAnnotationClassname()); assertEquals(0, ai.getElementNames().size());
assertEquals(FooAnn.class.getName(), anns[0].getAnnotationClassname());
/** * Returns <code>true</code> if method is annotated with one of provided annotation. */ default boolean hasAnnotation(final Class<? extends Annotation>... an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return false; } for (Class<? extends Annotation> annotationClass : an) { String anName = annotationClass.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return true; } } } return false; }
/** * Returns <code>true</code> if method is annotated with provided annotation. */ default AnnotationInfo getAnnotation(final Class<? extends Annotation> an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return null; } String anName = an.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return ann; } } return null; }
/** * Returns <code>true</code> if class is annotated with one of provided annotation. */ public boolean hasAnnotation(ClassInfo classInfo, Class<? extends Annotation>... an) { AnnotationInfo[] anns = classInfo.getAnnotations(); if (anns == null) { return false; } for (Class<? extends Annotation> annotationClass : an) { String anName = annotationClass.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return true; } } } return false; }
/** * Finds annotation in class info. Returns <code>null</code> if annotation doesn't exist. */ default AnnotationInfo getAnnotation(final Class<? extends Annotation> an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return null; } String anName = an.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return ann; } } return null; }
/** * Returns <code>true</code> if method is annotated with provided annotation. */ public AnnotationInfo getAnnotation(MethodInfo methodInfo, Class<? extends Annotation> mi) { AnnotationInfo[] anns = methodInfo.getAnnotations(); if (anns == null) { return null; } String anName = mi.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return ann; } } return null; }
/** * Finds annotation in class info. Returns <code>null</code> if annotation doesn't exist. */ public AnnotationInfo getAnnotation(ClassInfo classInfo, Class<? extends Annotation> an) { AnnotationInfo[] anns = classInfo.getAnnotations(); if (anns == null) { return null; } String anName = an.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return ann; } } return null; }
/** * Returns <code>true</code> if method is annotated with one of provided annotation. */ public boolean hasAnnotation(MethodInfo methodInfo, Class<? extends Annotation>... an) { AnnotationInfo[] anns = methodInfo.getAnnotations(); if (anns == null) { return false; } for (Class<? extends Annotation> annotationClass : an) { String anName = annotationClass.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return true; } } } return false; }
/** * Returns <code>true</code> if class is annotated with one of provided annotation. */ default boolean hasAnnotation(final Class<? extends Annotation>... an) { AnnotationInfo[] anns = getAnnotations(); if (anns == null) { return false; } for (Class<? extends Annotation> annotationClass : an) { String anName = annotationClass.getName(); for (AnnotationInfo ann : anns) { if (ann.getAnnotationClassname().equals(anName)) { return true; } } } return false; }
String annotationClass = ann.getAnnotationClassname(); String annotationClass = ann.getAnnotationClassname();