All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.weld.annotated.slim.unbacked.UnbackedAnnotated Maven / Gradle / Ivy

Go to download

This jar bundles all the bits of Weld and CDI required for running in a Servlet container.

There is a newer version: 6.0.0.Beta4
Show newest version
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 annotationType) {
        return getAnnotation(annotationType) != null;
    }

    public Set getTypeClosure() {
        return typeClosure;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy