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

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

There is a newer version: 3.0.0.Alpha1
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 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