本文整理汇总了Java中javax.enterprise.inject.spi.AnnotatedMember类的典型用法代码示例。如果您正苦于以下问题:Java AnnotatedMember类的具体用法?Java AnnotatedMember怎么用?Java AnnotatedMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnnotatedMember类属于javax.enterprise.inject.spi包,在下文中一共展示了AnnotatedMember类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAnnotatedMember
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private <X, A extends AnnotatedMember<? super X>> A getAnnotatedMember(Class<X> javaClass, String memberName,
BeanManager beanManager) {
AnnotatedType<X> type = beanManager.createAnnotatedType(javaClass);
for (AnnotatedField<? super X> field : type.getFields()) {
if (field.getJavaMember().getName().equals(memberName)) {
return (A) field;
}
}
for (AnnotatedMethod<? super X> method : type.getMethods()) {
if (method.getJavaMember().getName().equals(memberName)) {
return (A) method;
}
}
throw new IllegalArgumentException("Member " + memberName + " not found on " + javaClass);
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:17,代码来源:InjectSPITestCase.java
示例2: getConfigKey
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
static String getConfigKey(InjectionPoint ip, ConfigProperty configProperty) {
String key = configProperty.name();
if (!key.trim().isEmpty()) {
return key;
}
if (ip.getAnnotated() instanceof AnnotatedMember) {
AnnotatedMember member = (AnnotatedMember) ip.getAnnotated();
AnnotatedType declaringType = member.getDeclaringType();
if (declaringType != null) {
String[] parts = declaringType.getJavaClass().getCanonicalName().split("\\.");
StringBuilder sb = new StringBuilder(parts[0]);
for (int i = 1; i < parts.length; i++) {
sb.append(".").append(parts[i]);
}
sb.append(".").append(member.getJavaMember().getName());
return sb.toString();
}
}
throw new IllegalStateException("Could not find default name for @ConfigProperty InjectionPoint " + ip);
}
开发者ID:wildfly-extras,项目名称:wildfly-microprofile-config,代码行数:21,代码来源:ConfigExtension.java
示例3: registerMetrics
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
void registerMetrics(@Observes AfterDeploymentValidation adv, BeanManager manager) {
// Produce and register custom metrics
MetricRegistry registry = getReference(manager, MetricRegistry.class);
MetricName name = getReference(manager, MetricName.class);
for (Map.Entry<Bean<?>, AnnotatedMember<?>> bean : metrics.entrySet()) {
if (// skip non @Default beans
!bean.getKey().getQualifiers().contains(DEFAULT)
// skip producer methods with injection point metadata
|| hasInjectionPointMetadata(bean.getValue())) {
continue;
}
String metricName = name.of(bean.getValue());
registry.register(metricName, getReference(manager, bean.getValue().getBaseType(), bean.getKey()));
}
// Let's clear the collected metric producers
metrics.clear();
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:MetricCdiInjectionExtension.java
示例4: getConfigKey
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
/**
* Get the property key to use.
* In case the {@link ConfigProperty#name()} is empty we will try to determine the key name from the InjectionPoint.
*/
public static String getConfigKey(InjectionPoint ip, ConfigProperty configProperty) {
String key = configProperty.name();
if (key.length() > 0) {
return key;
}
if (ip.getAnnotated() instanceof AnnotatedMember) {
AnnotatedMember member = (AnnotatedMember) ip.getAnnotated();
AnnotatedType declaringType = member.getDeclaringType();
if (declaringType != null) {
String[] parts = declaringType.getJavaClass().getName().split(".");
String cn = parts[parts.length-1];
parts[parts.length-1] = Character.toLowerCase(cn.charAt(0)) + (cn.length() > 1 ? cn.substring(1) : "");
StringBuilder sb = new StringBuilder(parts[0]);
for (int i = 1; i < parts.length; i++) {
sb.append(".").append(parts[i]);
}
// now add the field name
sb.append(".").append(member.getJavaMember().getName());
return sb.toString();
}
}
throw new IllegalStateException("Could not find default name for @ConfigProperty InjectionPoint " + ip);
}
开发者ID:struberg,项目名称:javaConfig,代码行数:30,代码来源:ConfigInjectionBean.java
示例5: processProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
/**
* Collect all SqlSessionFactory producers annotated with SessionFactoryProvider.
*
* @param <T> the generic type
* @param <X> the generic type
* @param pp the pp
*/
@SuppressWarnings("UnusedDeclaration")
protected <T, X> void processProducer(@Observes final ProcessProducer<T, X> pp) {
final AnnotatedMember<T> am = pp.getAnnotatedMember();
final boolean isAnnotated = am.isAnnotationPresent(SessionFactoryProvider.class);
final boolean isSqlSessionFactory = am.getBaseType().equals(SqlSessionFactory.class);
final Object[] logData = { am.getJavaMember().getDeclaringClass().getSimpleName(), am.getJavaMember().getName() };
if (isAnnotated && isSqlSessionFactory) {
LOGGER.log(Level.INFO, "MyBatis CDI Module - SqlSessionFactory producer {0}.{1}", logData);
this.sessionProducers.add(new BeanKey((Class<Type>) (Type) SqlSession.class, am.getAnnotations()));
} else if (isAnnotated && !isSqlSessionFactory) {
LOGGER.log(Level.SEVERE, "MyBatis CDI Module - Invalid return type (Must be SqlSessionFactory): {0}.{1}",
logData);
pp.addDefinitionError(new MybatisCdiConfigurationException(String
.format("SessionFactoryProvider producers must return SqlSessionFactory (%s.%s)", logData[0], logData[1])));
} else if (!isAnnotated && isSqlSessionFactory) {
LOGGER.log(Level.WARNING,
"MyBatis CDI Module - Ignored SqlSessionFactory producer because it is not annotated with @SessionFactoryProvider: {0}.{1}",
logData);
}
}
开发者ID:mybatis,项目名称:cdi,代码行数:28,代码来源:MybatisExtension.java
示例6: configuration
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
private void configuration(@Observes AfterDeploymentValidation adv, BeanManager manager) {
// Fire configuration event
manager.fireEvent(configuration);
configuration.unmodifiable();
// Produce and register custom metrics
MetricRegistry registry = getReference(manager, MetricRegistry.class);
MetricName name = getReference(manager, MetricName.class);
for (Map.Entry<Bean<?>, AnnotatedMember<?>> bean : metrics.entrySet()) {
// TODO: add MetricSet metrics into the metric registry
if (bean.getKey().getTypes().contains(MetricSet.class)
// skip non @Default beans
|| !bean.getKey().getQualifiers().contains(DEFAULT)
// skip producer methods with injection point
|| hasInjectionPoints(bean.getValue()))
continue;
registry.register(name.of(bean.getValue()), (Metric) getReference(manager, bean.getValue().getBaseType(), bean.getKey()));
}
// Let's clear the collected metric producers
metrics.clear();
}
开发者ID:astefanutti,项目名称:metrics-cdi,代码行数:23,代码来源:MetricsExtension.java
示例7: hasInjectionPointMetadata
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
private static boolean hasInjectionPointMetadata(AnnotatedMember<?> member) {
if (!(member instanceof AnnotatedMethod)) {
return false;
}
AnnotatedMethod<?> method = (AnnotatedMethod<?>) member;
for (AnnotatedParameter<?> parameter : method.getParameters()) {
if (parameter.getBaseType().equals(InjectionPoint.class)) {
return true;
}
}
return false;
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:13,代码来源:MetricCdiInjectionExtension.java
示例8: of
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
@Override
public String of(InjectionPoint ip) {
Annotated annotated = ip.getAnnotated();
if (annotated instanceof AnnotatedMember) {
return of((AnnotatedMember<?>) annotated);
} else if (annotated instanceof AnnotatedParameter) {
return of((AnnotatedParameter<?>) annotated);
} else {
throw new IllegalArgumentException("Unable to retrieve metric name for injection point [" + ip + "], only members and parameters are supported");
}
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:12,代码来源:SeMetricName.java
示例9: processCommandBusProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
<T, X extends CommandBus> void processCommandBusProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> originalProducer = processProducer.getProducer();
Producer<X> producer = new AutoConfiguringCommandBusProducer<>(originalProducer,
annotatedMember, getAggregateRoots(), getCommandHandlers(), beanManager);
processProducer.setProducer(producer);
}
}
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:14,代码来源:AxonCdiExtension.java
示例10: processEventStoreProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
<T, X extends EventStore> void processEventStoreProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> originalProducer = processProducer.getProducer();
Producer<X> producer = new AutoConfiguringEventStoreProducer<>(originalProducer,
annotatedMember,
getEventHandlers(),
getSagas(), beanManager);
processProducer.setProducer(producer);
}
}
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:14,代码来源:AxonCdiExtension.java
示例11: processSnapshotterProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
<T, X extends Snapshotter> void processSnapshotterProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
Producer<X> originalProducer = processProducer.getProducer();
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> producer = new AutoConfiguringAggregateSnapshotterProducer<>(originalProducer,
annotatedMember, getAggregateRoots(), beanManager);
processProducer.setProducer(producer);
}
}
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:12,代码来源:AxonCdiExtension.java
示例12: processSagaRepositoryProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
<T, X extends SagaRepository<?>> void processSagaRepositoryProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
Producer<X> originalProducer = processProducer.getProducer();
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> producer = new AutoConfiguringSagaRepositoryProducer<>(originalProducer,
annotatedMember, beanManager);
processProducer.setProducer(producer);
}
}
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:12,代码来源:AxonCdiExtension.java
示例13: AbstractAutoConfiguringProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
public AbstractAutoConfiguringProducer(final Producer<X> wrappedProducer,
final AnnotatedMember<?> annotatedMember,
final BeanManager beanManager) {
this.wrappedProducer = wrappedProducer;
this.beanManager = beanManager;
this.annotatedMember = annotatedMember;
}
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:8,代码来源:AbstractAutoConfiguringProducer.java
示例14: AutoConfiguringEventStoreProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
public AutoConfiguringEventStoreProducer(final Producer<X> wrappedProducer,
final AnnotatedMember<?> annotatedMember,
final Set<HandlerInfo> eventHandlersInfo,
final Set<SagaInfo> sagasInfo,
final BeanManager beanManager) {
super(wrappedProducer, annotatedMember, beanManager);
this.eventHandlersInfo = eventHandlersInfo;
this.sagaManagersInfo = SagaManagerInfo.from(sagasInfo);
}
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:10,代码来源:AutoConfiguringEventStoreProducer.java
示例15: AutoConfiguringCommandBusProducer
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
public AutoConfiguringCommandBusProducer(Producer<X> wrappedProducer,
AnnotatedMember<?> annotatedMember,
Set<AggregateRootInfo> aggregateRootsInfo,
Set<HandlerInfo> commandHandlersInfo,
BeanManager beanManager) {
super(wrappedProducer, annotatedMember, beanManager);
this.commandHandlersInfo = commandHandlersInfo;
this.aggregateRootsInfo = aggregateRootsInfo;
}
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:10,代码来源:AutoConfiguringCommandBusProducer.java
示例16: handleAnnotatedMember
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
private void handleAnnotatedMember(AnnotatedMember<?> member) {
if (member.isAnnotationPresent(PersistenceContext.class)) {
PersistenceContext persistenceContext = member.getAnnotation(PersistenceContext.class);
injectedPersistenceContexts.put(persistenceContext.unitName(), member);
}
if (member.isAnnotationPresent(PersistenceUnit.class)) {
PersistenceUnit persistenceUnit = member.getAnnotation(PersistenceUnit.class);
injectedPersistenceUnits.add(persistenceUnit.unitName());
}
}
开发者ID:spearal,项目名称:spearal-jpa2,代码行数:11,代码来源:SpearalExtension.java
示例17: produceMissingPersistenceUnits
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
public void produceMissingPersistenceUnits(@Observes AfterTypeDiscovery event, BeanManager beanManager) {
for (String unitName : injectedPersistenceUnits)
injectedPersistenceContexts.remove(unitName);
for (AnnotatedMember<?> member : injectedPersistenceContexts.values()) {
if (!member.isAnnotationPresent(SpearalEnabled.class))
continue;
PersistenceContext persistenceContext = member.getAnnotation(PersistenceContext.class);
try {
final Set<Annotation> annotations = new HashSet<Annotation>(member.getAnnotations());
Iterator<Annotation> ia = annotations.iterator();
while (ia.hasNext()) {
Annotation a = ia.next();
if (a.annotationType().equals(PersistenceContext.class))
ia.remove();
}
PersistenceUnit persistenceUnit = new PersistenceUnitAnnotation(persistenceContext.name(), persistenceContext.unitName());
annotations.add(persistenceUnit);
final AnnotatedType<PersistenceUnitProducer> annotatedPU = new AnnotatedPersistenceUnitProducerType(annotations);
event.addAnnotatedType(annotatedPU, "org.spearal.jpa2.PersistenceUnit." + persistenceContext.unitName());
}
catch (Exception e) {
log.logp(Level.WARNING, SpearalExtension.class.getName(), "afterTypeDiscovery", "Could not setup PersistenceUnit integration {0}", new Object[] { persistenceContext.unitName() });
}
}
}
开发者ID:spearal,项目名称:spearal-jpa2,代码行数:33,代码来源:SpearalExtension.java
示例18: hasInjectionPoints
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
private static boolean hasInjectionPoints(AnnotatedMember<?> member) {
if (!(member instanceof AnnotatedMethod))
return false;
AnnotatedMethod<?> method = (AnnotatedMethod<?>) member;
for (AnnotatedParameter<?> parameter : method.getParameters()) {
if (parameter.getBaseType().equals(InjectionPoint.class))
return true;
}
return false;
}
开发者ID:astefanutti,项目名称:metrics-cdi,代码行数:11,代码来源:MetricsExtension.java
示例19: of
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
@Override
public String of(InjectionPoint ip) {
Annotated annotated = ip.getAnnotated();
if (annotated instanceof AnnotatedMember)
return of((AnnotatedMember<?>) annotated);
else if (annotated instanceof AnnotatedParameter)
return of((AnnotatedParameter<?>) annotated);
else
throw new IllegalArgumentException("Unable to retrieve metric name for injection point [" + ip + "], only members and parameters are supported");
}
开发者ID:astefanutti,项目名称:metrics-cdi,代码行数:11,代码来源:SeMetricName.java
示例20: AnnotatedMemberDelegate
import javax.enterprise.inject.spi.AnnotatedMember; //导入依赖的package包/类
AnnotatedMemberDelegate(AnnotatedMember<T> delegate, Set<Annotation> annotations) {
super(delegate, annotations);
this.delegate = delegate;
}
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:AnnotatedMemberDelegate.java
注:本文中的javax.enterprise.inject.spi.AnnotatedMember类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论