Search in sources :

Example 1 with NamedImpl

use of org.glassfish.hk2.utilities.NamedImpl in project Payara by payara.

the class HK2IntegrationUtilities method getHK2Qualifiers.

private static Set<Annotation> getHK2Qualifiers(InjectionPoint injectionPoint) {
    Set<Annotation> setQualifiers = injectionPoint.getQualifiers();
    Set<Annotation> retVal = new HashSet<Annotation>();
    for (Annotation anno : setQualifiers) {
        if (anno.annotationType().equals(Default.class))
            continue;
        if (anno.annotationType().equals(Named.class)) {
            Named named = (Named) anno;
            if ("".equals(named.value())) {
                Annotated annotated = injectionPoint.getAnnotated();
                if (annotated instanceof AnnotatedField) {
                    AnnotatedField<?> annotatedField = (AnnotatedField<?>) annotated;
                    Field field = annotatedField.getJavaMember();
                    anno = new NamedImpl(field.getName());
                }
            }
        }
        retVal.add(anno);
    }
    return retVal;
}
Also used : Named(javax.inject.Named) Annotated(javax.enterprise.inject.spi.Annotated) Field(java.lang.reflect.Field) AnnotatedField(javax.enterprise.inject.spi.AnnotatedField) NamedImpl(org.glassfish.hk2.utilities.NamedImpl) AnnotatedField(javax.enterprise.inject.spi.AnnotatedField) Annotation(java.lang.annotation.Annotation) HashSet(java.util.HashSet)

Aggregations

Annotation (java.lang.annotation.Annotation)1 Field (java.lang.reflect.Field)1 HashSet (java.util.HashSet)1 Annotated (javax.enterprise.inject.spi.Annotated)1 AnnotatedField (javax.enterprise.inject.spi.AnnotatedField)1 Named (javax.inject.Named)1 NamedImpl (org.glassfish.hk2.utilities.NamedImpl)1