ioinformarics.oss.jackson.module.jsonld.util.AnnotationsUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-jsonld Show documentation
Show all versions of jackson-jsonld Show documentation
JSON-LD Module for Jackson
The newest version!
package ioinformarics.oss.jackson.module.jsonld.util;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
/**
* @author Alexander De Leon ([email protected])
*/
public abstract class AnnotationsUtils {
public static boolean isAnnotationPresent(Class> type, Class extends Annotation> annotationType) {
return isAnnotationPresent(type, annotationType, new ArrayList<>());
}
protected static boolean isAnnotationPresent(Class> type, Class extends Annotation> annotationType, List> ignore) {
if(type.isAnnotationPresent(annotationType)) {
return true;
}
if(type.getAnnotations().length == 0) {
return false;
}
for(Annotation a : type.getAnnotations()) {
if(!ignore.contains(a.annotationType())) {
ignore.add(type);
if(isAnnotationPresent(a.annotationType(), annotationType, ignore)) {
return true;
}
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy