org.jboss.weld.annotated.slim.unbacked.UnbackedAnnotated Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weld-servlet-shaded Show documentation
Show all versions of weld-servlet-shaded Show documentation
This jar bundles all the bits of Weld and CDI required for running in a Servlet container.
package org.jboss.weld.annotated.slim.unbacked;
import static org.jboss.weld.util.reflection.Reflections.cast;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Set;
import org.jboss.weld.annotated.slim.BaseAnnotated;
public abstract class UnbackedAnnotated extends BaseAnnotated {
private final Set annotations;
private final Set typeClosure;
public UnbackedAnnotated(Type baseType, Set typeClosure, Set annotations) {
super(baseType);
this.typeClosure = typeClosure;
this.annotations = annotations;
}
public T getAnnotation(Class annotationType) {
for (Annotation annotation : annotations) {
if (annotation.annotationType().equals(annotationType)) {
return cast(annotation);
}
}
return null;
}
public Set getAnnotations() {
return annotations;
}
public boolean isAnnotationPresent(Class extends Annotation> annotationType) {
return getAnnotation(annotationType) != null;
}
public Set getTypeClosure() {
return typeClosure;
}
}