Package org.jboss.weld.metadata

Examples of org.jboss.weld.metadata.TypeStore


    class CustomInjectionPoint implements InjectionPoint {
        private final EnhancedAnnotatedField<CustomWindowFrame, ?> windowField;

        public CustomInjectionPoint() {
            TypeStore ts = new TypeStore();
            ClassTransformer transformer = new ClassTransformer(ts, new SharedObjectCache(), ReflectionCacheFactory.newInstance(ts), RegistrySingletonProvider.STATIC_INSTANCE);
            EnhancedAnnotatedType<?> targetClass = transformer.getEnhancedAnnotatedType(CustomWindowFrame.class, AnnotatedTypeIdentifier.NULL_BDA_ID);
            windowField = targetClass.getDeclaredEnhancedField("window");
        }
View Full Code Here


   }


    @Test
    public void testInterceptorModel() {
        TypeStore typeStore = new TypeStore();
        InterceptorBindingModel<SecondaryInterceptionBinding> interceptorBindingModel
                = new InterceptorBindingModel<SecondaryInterceptionBinding>(new ClassTransformer(typeStore, new SharedObjectCache(), ReflectionCacheFactory.newInstance(typeStore), RegistrySingletonProvider.STATIC_INSTANCE).getEnhancedAnnotation(SecondaryInterceptionBinding.class));
        Set<Annotation> annotations = interceptorBindingModel.getInheritedInterceptionBindingTypes();
        assert annotations.size() != 0;
    }
View Full Code Here

   /*
    * description = "WELD-568"
    */
    @Test
    public void testWeldClassForGenericSuperclass() {
        TypeStore ts = new TypeStore();
        EnhancedAnnotatedType<StringProcessor> weldClass = new ClassTransformer(ts, new SharedObjectCache(), ReflectionCacheFactory.newInstance(ts), RegistrySingletonProvider.STATIC_INSTANCE).getEnhancedAnnotatedType(StringProcessor.class, AnnotatedTypeIdentifier.NULL_BDA_ID);
        Collection<EnhancedAnnotatedMethod<?, ? super StringProcessor>> methods = weldClass.getEnhancedMethods();
        //assert methods.size() == 2;
        List<EnhancedAnnotatedMethod<?, ?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
        Assert.assertEquals(3, interceptableMethods.size());
View Full Code Here

    @BeforeMethod
    public void beforeMethod() {
        BeanIdentifierIndex beanIdentifierIndex = new BeanIdentifierIndex();
        beanIdentifierIndex.build(Collections.<Bean<?>>emptySet());
        this.typeStore = new TypeStore();
        this.classTransformer = new ClassTransformer(typeStore, new SharedObjectCache(), ReflectionCacheFactory.newInstance(typeStore), RegistrySingletonProvider.STATIC_INSTANCE);
        this.services = new SimpleServiceRegistry();
        this.services.add(MetaAnnotationStore.class, new MetaAnnotationStore(classTransformer));
        this.services.add(ContextualStore.class, new ContextualStoreImpl(STATIC_INSTANCE, beanIdentifierIndex));
        this.services.add(ClassTransformer.class, classTransformer);
View Full Code Here

     * tests the AnnotatedTypes.compareAnnotatedTypes
     */
    @Test
    public void testComparison() throws SecurityException, NoSuchFieldException, NoSuchMethodException {
        //check that two weld classes on the same underlying are equal
        TypeStore ts = new TypeStore();
        ClassTransformer ct = new ClassTransformer(ts, new SharedObjectCache(), ReflectionCacheFactory.newInstance(ts), RegistrySingletonProvider.STATIC_INSTANCE);
        EnhancedAnnotatedType<Chair> chair1 = EnhancedAnnotatedTypeImpl.of(BackedAnnotatedType.of(Chair.class, ct.getSharedObjectCache(), ct.getReflectionCache(), RegistrySingletonProvider.STATIC_INSTANCE, AnnotatedTypeIdentifier.NULL_BDA_ID), ct);
        EnhancedAnnotatedType<Chair> chair2 = EnhancedAnnotatedTypeImpl.of(BackedAnnotatedType.of(Chair.class, ct.getSharedObjectCache(), ct.getReflectionCache(), RegistrySingletonProvider.STATIC_INSTANCE, AnnotatedTypeIdentifier.NULL_BDA_ID), ct);
        Assert.assertTrue(AnnotatedTypes.compareAnnotatedTypes(chair1, chair2));

View Full Code Here

    * description = "WELD-568"
    */
    @Category(Broken.class)
    @Test
    public void testWeldClassForCovariantReturnType() {
        TypeStore typeStore = new TypeStore();
        EnhancedAnnotatedType<Attacker> weldClass = new ClassTransformer(typeStore, new SharedObjectCache(), ReflectionCacheFactory.newInstance(typeStore), RegistrySingletonProvider.STATIC_INSTANCE).getEnhancedAnnotatedType(Attacker.class, AnnotatedTypeIdentifier.NULL_BDA_ID);
        Collection<EnhancedAnnotatedMethod<?, ? super Attacker>> methods = weldClass.getEnhancedMethods();
        Assert.assertEquals(4, methods.size());
        List<EnhancedAnnotatedMethod<?, ?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
        Assert.assertEquals(4, interceptableMethods.size());
View Full Code Here

    }

    @Override
    public void addInterceptorBinding(Class<? extends Annotation> bindingType, Annotation... bindingTypeDef) {
        checkWithinObserverNotification();
        TypeStore typeStore = getTypeStore();
        typeStore.add(bindingType, InterceptorBindingTypeLiteral.INSTANCE);
        for (Annotation a : bindingTypeDef) {
            typeStore.add(bindingType, a);
        }
        getBeanManager().getServices().get(ClassTransformer.class).clearAnnotationData(bindingType);
        getBeanManager().getServices().get(MetaAnnotationStore.class).clearAnnotationData(bindingType);
    }
View Full Code Here

    }

    @Override
    public void addStereotype(Class<? extends Annotation> stereotype, Annotation... stereotypeDef) {
        checkWithinObserverNotification();
        TypeStore typeStore = getTypeStore();
        typeStore.add(stereotype, StereotypeLiteral.INSTANCE);
        for (Annotation a : stereotypeDef) {
            typeStore.add(stereotype, a);
        }
        getBeanManager().getServices().get(ClassTransformer.class).clearAnnotationData(stereotype);
        getBeanManager().getServices().get(MetaAnnotationStore.class).clearAnnotationData(stereotype);
    }
View Full Code Here

    private void setupInitialServices() {
        if (initialServices.contains(TypeStore.class)) {
            return;
        }
        // instantiate initial services which we need for this phase
        TypeStore store = new TypeStore();
        SharedObjectCache cache = new SharedObjectCache();
        ReflectionCache reflectionCache = ReflectionCacheFactory.newInstance(store);
        ClassTransformer classTransformer = new ClassTransformer(store, cache, reflectionCache, contextId);
        initialServices.add(TypeStore.class, store);
        initialServices.add(SharedObjectCache.class, cache);
View Full Code Here

TOP

Related Classes of org.jboss.weld.metadata.TypeStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.