当前位置: 首页>>代码示例>>Java>>正文


Java BeanAttributes类代码示例

本文整理汇总了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");
            }
        }
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:30,代码来源:MPJWTExtension.java

示例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();
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:16,代码来源:ClaimProviderBeanAttributes.java

示例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(","));
}
 
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:12,代码来源:CdiSpiHelper.java

示例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);
    }
}
 
开发者ID:HotswapProjects,项目名称:HotswapAgent,代码行数:31,代码来源:BeanReloadExecutor.java

示例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);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:35,代码来源:CdiEjbBean.java

示例6: DriverBeanAttributes

import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
DriverBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
    delegate = beanAttributes;
    this.profile = profile;
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:5,代码来源:Neo4jExtension.java

示例7: OrientBeanAttributes

import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
OrientBeanAttributes(BeanAttributes<T> delegate, String profile) {
    this.delegate = delegate;
    this.profile = profile;
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:5,代码来源:OrientBeanAttributes.java

示例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));
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:7,代码来源:OrientExtension.java

示例9: ClusterBeanAttributes

import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
ClusterBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
    delegate = beanAttributes;
    this.profile = profile;
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:5,代码来源:CassandraExtension.java

示例10: SessionBeanAttributes

import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
SessionBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
    delegate = beanAttributes;
    this.profile = profile;
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:5,代码来源:CassandraExtension.java

示例11: MongoClientBeanAttributes

import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
MongoClientBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
    delegate = beanAttributes;
    this.profile = profile;
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:5,代码来源:MongoExtension.java

示例12: MongoDatabaseBeanAttributes

import javax.enterprise.inject.spi.BeanAttributes; //导入依赖的package包/类
MongoDatabaseBeanAttributes(BeanAttributes<T> beanAttributes, String profile) {
    delegate = beanAttributes;
    this.profile = profile;
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:5,代码来源:MongoExtension.java

示例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();
                }
            });
        }
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:44,代码来源:ImplicitArchiveExtension.java

示例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;
}
 
开发者ID:satago,项目名称:tapestry-jpa-transactions,代码行数:7,代码来源:NoopBeanManager.java

示例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;
}
 
开发者ID:satago,项目名称:tapestry-jpa-transactions,代码行数:7,代码来源:NoopBeanManager.java


注:本文中的javax.enterprise.inject.spi.BeanAttributes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。