Search in sources :

Example 1 with Annotated

use of jakarta.enterprise.inject.spi.Annotated in project cdi by eclipse-ee4j.

the class AbstractAnnotatedTest method shouldFindAnnotationsOnAnnotated.

@Test
public void shouldFindAnnotationsOnAnnotated() {
    Annotated annotated = getAnnotated();
    Set<Repeater> repeaters = annotated.getAnnotations(Repeater.class);
    Assert.assertEquals(repeaters, new LinkedHashSet<>(asList(getAnnotationsByType(Repeater.class))));
}
Also used : Annotated(jakarta.enterprise.inject.spi.Annotated) Test(org.testng.annotations.Test)

Example 2 with Annotated

use of jakarta.enterprise.inject.spi.Annotated in project cdi by eclipse-ee4j.

the class AbstractAnnotatedTest method shouldReturnSingletonForNonRepeatableAnnotation.

@Test
public void shouldReturnSingletonForNonRepeatableAnnotation() {
    Annotated annotated = getAnnotated();
    Set<Repeaters> repeaters = annotated.getAnnotations(Repeaters.class);
    Assert.assertEquals(repeaters, Collections.singleton(getAnnotation(Repeaters.class)));
}
Also used : Annotated(jakarta.enterprise.inject.spi.Annotated) Test(org.testng.annotations.Test)

Example 3 with Annotated

use of jakarta.enterprise.inject.spi.Annotated in project myfaces by apache.

the class FacesDataModelExtension method collect.

public <T> void collect(@Observes ProcessManagedBean<T> event) {
    Annotated annotated = event.getAnnotatedBeanClass();
    if (annotated.isAnnotationPresent(FacesDataModel.class)) {
        FacesDataModel model = (FacesDataModel) annotated.getAnnotation(FacesDataModel.class);
        boolean hasValue = model.forClass() != null;
        if (hasValue) {
            types.add(new FacesDataModelInfo(annotated.getBaseType(), model.forClass()));
        }
    }
}
Also used : Annotated(jakarta.enterprise.inject.spi.Annotated) FacesDataModel(jakarta.faces.model.FacesDataModel)

Example 4 with Annotated

use of jakarta.enterprise.inject.spi.Annotated in project helidon by oracle.

the class HikariCPBackedDataSourceExtension method processAnnotatedType.

private void processAnnotatedType(@Observes @WithAnnotations({ DataSourceDefinition.class, DataSourceDefinitions.class }) final ProcessAnnotatedType<?> event) {
    if (event != null) {
        final Annotated annotated = event.getAnnotatedType();
        if (annotated != null) {
            final Set<? extends DataSourceDefinition> dataSourceDefinitions = annotated.getAnnotations(DataSourceDefinition.class);
            if (dataSourceDefinitions != null && !dataSourceDefinitions.isEmpty()) {
                for (final DataSourceDefinition dsd : dataSourceDefinitions) {
                    assert dsd != null;
                    final Set<String> knownDataSourceNames = this.getDataSourceNames();
                    assert knownDataSourceNames != null;
                    final String dataSourceName = dsd.name();
                    if (!knownDataSourceNames.contains(dataSourceName)) {
                        final Entry<? extends String, ? extends Properties> entry = toProperties(dsd);
                        if (entry != null) {
                            this.putDataSourceProperties(dataSourceName, entry.getValue());
                        }
                    }
                }
            }
        }
    }
}
Also used : Annotated(jakarta.enterprise.inject.spi.Annotated) DataSourceDefinition(jakarta.annotation.sql.DataSourceDefinition)

Example 5 with Annotated

use of jakarta.enterprise.inject.spi.Annotated in project helidon by oracle.

the class OciCdiExtension method updateInjectionPoints.

/**
 * Add internal qualifier.
 *
 * @param event CDI event
 */
void updateInjectionPoints(@Observes ProcessInjectionPoint<?, ?> event) {
    InjectionPoint injectionPoint = event.getInjectionPoint();
    Annotated annotated = injectionPoint.getAnnotated();
    Type type = injectionPoint.getType();
    if (supportedTypes.contains(type)) {
        Named name = annotated.getAnnotation(Named.class);
        OciInternal internal = OciInternal.Literal.create((name == null ? "" : name.value()));
        event.configureInjectionPoint().addQualifier(internal);
    }
}
Also used : Annotated(jakarta.enterprise.inject.spi.Annotated) Named(jakarta.inject.Named) Type(java.lang.reflect.Type) InjectionPoint(jakarta.enterprise.inject.spi.InjectionPoint) ProcessInjectionPoint(jakarta.enterprise.inject.spi.ProcessInjectionPoint)

Aggregations

Annotated (jakarta.enterprise.inject.spi.Annotated)14 Type (java.lang.reflect.Type)6 AnnotatedParameter (jakarta.enterprise.inject.spi.AnnotatedParameter)4 AnnotatedType (jakarta.enterprise.inject.spi.AnnotatedType)4 ProcessAnnotatedType (jakarta.enterprise.inject.spi.ProcessAnnotatedType)4 PersistenceContextType (jakarta.persistence.PersistenceContextType)4 SynchronizationType (jakarta.persistence.SynchronizationType)4 AnnotatedField (jakarta.enterprise.inject.spi.AnnotatedField)2 InjectionPoint (jakarta.enterprise.inject.spi.InjectionPoint)2 ProcessInjectionPoint (jakarta.enterprise.inject.spi.ProcessInjectionPoint)2 AnnotatedParameterConfigurator (jakarta.enterprise.inject.spi.configurator.AnnotatedParameterConfigurator)2 Inject (jakarta.inject.Inject)2 EntityManager (jakarta.persistence.EntityManager)2 EntityManagerFactory (jakarta.persistence.EntityManagerFactory)2 Constructor (java.lang.reflect.Constructor)2 Member (java.lang.reflect.Member)2 Method (java.lang.reflect.Method)2 Test (org.testng.annotations.Test)2 DataSourceDefinition (jakarta.annotation.sql.DataSourceDefinition)1 AnnotatedMethod (jakarta.enterprise.inject.spi.AnnotatedMethod)1