org.snapscript.core.annotation.AnnotationExtractor Maven / Gradle / Ivy
package org.snapscript.core.annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.ArrayList;
import java.util.List;
public class AnnotationExtractor {
private final AnnotationConverter converter;
public AnnotationExtractor() {
this.converter = new AnnotationConverter();
}
public List extract(AnnotatedElement element) throws Exception {
List list = new ArrayList();
if(element != null) {
Object[] array = element.getAnnotations();
for(Object entry : array) {
Object result = converter.convert(entry);
Annotation annotation = (Annotation)result;
list.add(annotation);
}
}
return list;
}
}