/** * Get a the named annotation on this class, or null if the class does not have the named annotation. * * <p> * Also handles the {@link Inherited} meta-annotation, which causes an annotation to annotate a class and all of * its subclasses. * * <p> * Note that if you need to get multiple named annotations, it is faster to call {@link #getAnnotationInfo()}, * and then get the named annotations from the returned {@link AnnotationInfoList}, so that the returned list * doesn't have to be built multiple times. * * @param annotationName * The annotation name. * @return An {@link AnnotationInfo} object representing the named annotation on this class, or null if the * class does not have the named annotation. */ public AnnotationInfo getAnnotationInfo(final String annotationName) { return getAnnotationInfo().get(annotationName); }
/** * Resolves the {@link Class}[] of the {@code HandlesTypes}-annotations present on the given * {@code ServletContainerInitializer} implementation. * * @param servletContainerInitializerClassInfo The {@link ClassInfo} object representing the {@code ServletContainerInitializer} implementation * @return The classes listed in the {@code HandlesTypes} annotation of the given class. */ private List<ClassInfo> resolveHandledTypes(ClassInfo servletContainerInitializerClassInfo) { AnnotationInfo handlesTypes = servletContainerInitializerClassInfo.getAnnotationInfo(HANDLES_TYPES); Object[] value = (Object[]) handlesTypes.getParameterValues().get("value"); return Arrays.stream(value) .map(AnnotationClassRef.class::cast) .map(annotationClassRef -> { ClassInfo classInfo = annotationClassRef.getClassInfo(); if (classInfo == null) { log.warn("{} not found in the scan result, but declared in the @HandlesTypes annotation of {}", annotationClassRef.getName(), servletContainerInitializerClassInfo.getName()); } return classInfo; }) .filter(Objects::nonNull) .collect(Collectors.toList()); }
/** Get the names of all classes refernenced by this class. */ Set<String> getReferencedClassNames() { // refdClassNames came from class refs and type signatures in the constant pool of the classfile, // but there are other sources of class refs and type signatures that are coded as CONSTANT_Utf8_info // (such as enum classes and class references in annotation parameter values), so these need to be // added to the set of referenced classes. if (referencedClassNames == null) { referencedClassNames = new HashSet<>(); } getAnnotationInfo().getReferencedClassNames(referencedClassNames); getMethodInfo().getReferencedClassNames(referencedClassNames); getFieldInfo().getReferencedClassNames(referencedClassNames); // Get rid of self-references and references to java.lang.Object referencedClassNames.remove(name); referencedClassNames.remove("java.lang.Object"); return referencedClassNames; }
for (ClassInfo csvClassInfo : csvList) { final Class<?> csvClass = csvClassInfo.loadClass(); AnnotationInfo annotationInfo = csvClassInfo.getAnnotationInfo(Disabled.class.getCanonicalName()); if (annotationInfo == null) { LOGGER.info("Fluxtion generating CSV marshaller for:" + csvClass.getCanonicalName());
for (String cn : entities.getNames()) { ClassInfo ci = scanResult.getClassInfo(cn); AnnotationInfoList an = ci.getAnnotationInfo(); for (AnnotationInfo ai : an) { String name = ai.getName();