本文整理汇总了Java中javax.enterprise.inject.spi.BeanAttributes类的典型用法代码示例。如果您正苦于以下问题:Java BeanAttributes类的具体用法?Java BeanAttributes怎么用?Java BeanAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeanAttributes类属于javax.enterprise.inject.spi包,在下文中一共展示了BeanAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTypeToClaimProducer
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
/**
* Replace the general producer method BeanAttributes with one bound to the collected injection site
* types to properly reflect all of the type locations the producer method applies to.
*
* @param pba the ProcessBeanAttributes
* @see ClaimProviderBeanAttributes
*/
public void addTypeToClaimProducer(@Observes ProcessBeanAttributes pba) {
if (pba.getAnnotated().isAnnotationPresent(Claim.class)) {
Claim claim = pba.getAnnotated().getAnnotation(Claim.class);
if (claim.value().length() == 0 && claim.standard() == Claims.UNKNOWN) {
log.debugf("addTypeToClaimProducer: %s\n", pba.getAnnotated());
BeanAttributes delegate = pba.getBeanAttributes();
String name = delegate.getName();
if (delegate.getTypes().contains(Optional.class)) {
if (providerOptionalTypes.size() == 0) {
providerOptionalTypes.add(Optional.class);
}
pba.setBeanAttributes(new ClaimProviderBeanAttributes(delegate, providerOptionalTypes, providerQualifiers));
} else if (name != null && name.startsWith("RawClaimTypeProducer#")) {
if (rawTypes.size() == 0) {
rawTypes.add(Object.class);
}
pba.setBeanAttributes(new ClaimProviderBeanAttributes(delegate, rawTypes, rawTypeQualifiers));
log.debugf("Setup RawClaimTypeProducer BeanAttributes");
}
}
}
}
示例2: ClaimProviderBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
/**
* Decorate the ConfigPropertyProducer BeanAttributes to set the types the producer applies to. This set is collected
* from all injection points annotated with @ConfigProperty.
*
* @param delegate - the original producer method BeanAttributes
* @param types - the full set of @ConfigProperty injection point types
*/
public ClaimProviderBeanAttributes(BeanAttributes<Object> delegate, Set<Type> types, Set<Annotation> qualifiers) {
this.delegate = delegate;
this.types = types;
this.qualifiers = qualifiers;
if (types.size() == 0) {
Thread.dumpStack();
}
}
示例3: createBeanAttributesId
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
/**
* Generates a unique signature for {@link BeanAttributes}.
*/
static String createBeanAttributesId(BeanAttributes<?> attributes) {
return Stream.of(attributes.getName(),
attributes.getScope().getName(),
createAnnotationCollectionId(attributes.getQualifiers()),
createTypeCollectionId(attributes.getTypes()))
.filter(Objects::nonNull)
.collect(joining(","));
}
示例4: doDefineNewManagedBean
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void doDefineNewManagedBean(BeanManagerImpl beanManager, String bdaId,
Class<?> beanClass) {
try {
ClassTransformer classTransformer = getClassTransformer();
SlimAnnotatedType<?> annotatedType = classTransformer.getBackedAnnotatedType(beanClass, bdaId);
boolean managedBeanOrDecorator = Beans.isTypeManagedBeanOrDecoratorOrInterceptor(annotatedType);
if (managedBeanOrDecorator) {
EnhancedAnnotatedType eat = EnhancedAnnotatedTypeImpl.of(annotatedType, classTransformer);
BeanAttributes attributes = BeanAttributesFactory.forBean(eat, beanManager);
ManagedBean<?> bean = ManagedBean.of(attributes, eat, beanManager);
Field field = beanManager.getClass().getDeclaredField("beanSet");
field.setAccessible(true);
field.set(beanManager, Collections.synchronizedSet(new HashSet<Bean<?>>()));
// TODO:
beanManager.addBean(bean);
beanManager.getBeanResolver().clear();
bean.initializeAfterBeanDiscovery();
// define managed bean
// beanManager.cleanupAfterBoot();
LOGGER.debug("Bean defined '{}'", beanClass.getName());
} else {
// TODO : define session bean
LOGGER.warning("Bean NOT? defined '{}', session bean?", beanClass.getName());
}
} catch (Exception e) {
LOGGER.debug("Bean definition failed.", e);
}
}
示例5: CdiEjbBean
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
public CdiEjbBean(final BeanContext bc, final WebBeansContext webBeansContext, final Class beanClass, final AnnotatedType<T> at,
final InjectionTargetFactoryImpl<T> factory, final BeanAttributes<T> attributes) {
super(webBeansContext, toSessionType(bc.getComponentType()), at,
new EJBBeanAttributesImpl<T>(bc, attributes),
beanClass, factory);
this.beanContext = bc;
bc.set(Bean.class, this);
passivatingId = bc.getDeploymentID() + getReturnType().getName();
final boolean stateful = BeanType.STATEFUL.equals(bc.getComponentType());
final boolean isDependent = getScope().equals(Dependent.class);
isDependentAndStateful = isDependent && stateful;
if (webBeansContext.getBeanManagerImpl().isPassivatingScope(getScope()) && stateful) {
if (!getBeanContext().isPassivable()) {
throw new DefinitionException(
getBeanContext().getBeanClass()
+ " is a not apssivation-capable @Stateful with a scope "
+ getScope().getSimpleName() + " which need passivation");
}
passivable = true;
} else {
passivable = false;
}
if (!isDependent) {
for (final Type type : attributes.getTypes()) {
if (ParameterizedType.class.isInstance(type)) {
throw new DefinitionException("Parameterized session bean should be @Dependent: " + beanClass);
}
}
}
if (getAnnotatedType().isAnnotationPresent(Interceptor.class) || getAnnotatedType().isAnnotationPresent(Decorator.class)) {
throw new DefinitionException("An EJB can't be an interceptor or a decorator: " + beanClass);
}
}
示例6: DriverBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
DriverBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
delegate = beanAttributes;
this.profile = profile;
}
示例7: OrientBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
OrientBeanAttributes(BeanAttributes<T> delegate, String profile) {
this.delegate = delegate;
this.profile = profile;
}
示例8: getBean
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
private <T> Bean<T> getBean(BeanManager beanManager, Class<T> beanClass, String profile) {
BeanAttributes<T> beanAttributes = beanManager.createBeanAttributes(beanManager.createAnnotatedType(beanClass));
return beanManager.createBean(new OrientBeanAttributes<>(beanAttributes, profile), beanClass,
new OrientProducerFactory<>(beanClass, profile));
}
示例9: ClusterBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
ClusterBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
delegate = beanAttributes;
this.profile = profile;
}
示例10: SessionBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
SessionBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
delegate = beanAttributes;
this.profile = profile;
}
示例11: MongoClientBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
MongoClientBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
delegate = beanAttributes;
this.profile = profile;
}
示例12: MongoDatabaseBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
MongoDatabaseBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
delegate = beanAttributes;
this.profile = profile;
}
示例13: processBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
@SuppressWarnings("unused")
<T> void processBeanAttributes(@Observes ProcessBeanAttributes<T> pba, BeanManager beanManager) throws Exception {
final BeanAttributes<T> beanAttributes = pba.getBeanAttributes();
if (beanAttributes.getTypes().contains(Archive.class)) {
if (!DeploymentScoped.class.isAssignableFrom(beanAttributes.getScope())) {
pba.setBeanAttributes(new BeanAttributes<T>() {
@Override
public Set<Type> getTypes() {
return beanAttributes.getTypes();
}
@Override
public Set<Annotation> getQualifiers() {
Set<Annotation> qualifiers = new HashSet<>();
qualifiers.addAll(beanAttributes.getQualifiers());
qualifiers.add(ImplicitDeployment.Literal.INSTANCE);
qualifiers.removeIf(e -> Default.class.isAssignableFrom(e.getClass()));
return qualifiers;
}
@Override
public Class<? extends Annotation> getScope() {
return beanAttributes.getScope();
}
@Override
public String getName() {
return beanAttributes.getName();
}
@Override
public Set<Class<? extends Annotation>> getStereotypes() {
return beanAttributes.getStereotypes();
}
@Override
public boolean isAlternative() {
return beanAttributes.isAlternative();
}
});
}
}
}
示例14: createBeanAttributes
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
@Override
public <T> BeanAttributes<T> createBeanAttributes(AnnotatedType<T> type)
{
// TODO Auto-generated method stub
return null;
}
示例15: createBean
import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
@Override
public <T> Bean<T> createBean(BeanAttributes<T> attributes, Class<T> beanClass, InjectionTargetFactory<T> injectionTargetFactory)
{
// TODO Auto-generated method stub
return null;
}