use of org.jboss.weld.util.annotated.ForwardingAnnotatedType in project core by weld.
the class ModifyingExtension method registerAdditionalFooAnnotatedType.
public void registerAdditionalFooAnnotatedType(@Observes BeforeBeanDiscovery event, BeanManager manager) {
final AnnotatedType<Foo> anotherFoo = manager.createAnnotatedType(Foo.class);
AnnotatedType<Foo> modifiedAnotherFoo = new ForwardingAnnotatedType<Foo>() {
private final NamedLiteral qualifierInstance = new NamedLiteral("anotherFoo");
@Override
public AnnotatedType<Foo> delegate() {
return anotherFoo;
}
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
if (Named.class.equals(annotationType)) {
return cast(qualifierInstance);
}
return null;
}
@Override
public Set<Annotation> getAnnotations() {
return Collections.<Annotation>singleton(qualifierInstance);
}
@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
return Named.class.equals(annotationType);
}
};
event.addAnnotatedType(modifiedAnotherFoo);
}
use of org.jboss.weld.util.annotated.ForwardingAnnotatedType in project core by weld.
the class WeldClassTest method testMemberClassWithGenericTypes.
/*
* description = "WELD-216"
*/
@Test
public void testMemberClassWithGenericTypes() {
final AnnotatedType<?> at = transformer.getEnhancedAnnotatedType(new Kangaroo().procreate().getClass(), AnnotatedTypeIdentifier.NULL_BDA_ID);
transformer.getEnhancedAnnotatedType(new ForwardingAnnotatedType() {
@Override
public AnnotatedType delegate() {
return at;
}
}, AnnotatedTypeIdentifier.NULL_BDA_ID);
}
use of org.jboss.weld.util.annotated.ForwardingAnnotatedType in project core by weld.
the class WeldClassTest method testLocalClassWithGenericTypes.
/*
* description = "WELD-216"
*/
@Test
public /*
* Not isolated, depends on someone else initializing Containers.
*
* getUnproxyableClassException() catch(NoSuchMethodException)
* InstantiatorFactory.useInstantiators() <-- Needs Containers
*/
void testLocalClassWithGenericTypes() {
final AnnotatedType<?> at = transformer.getEnhancedAnnotatedType(new Koala().procreate().getClass(), AnnotatedTypeIdentifier.NULL_BDA_ID);
transformer.getEnhancedAnnotatedType(new ForwardingAnnotatedType() {
@Override
public AnnotatedType delegate() {
return at;
}
}, AnnotatedTypeIdentifier.NULL_BDA_ID);
}
use of org.jboss.weld.util.annotated.ForwardingAnnotatedType in project core by weld.
the class WeldClassTest method testAnonymousClassWithGenericTypes.
/*
* description = "WELD-216"
*/
@Test
public /*
* Not isolated, depends on someone else initializing Containers.
*
* getUnproxyableClassException() catch(NoSuchMethodException)
* InstantiatorFactory.useInstantiators() <-- Needs Containers
*/
void testAnonymousClassWithGenericTypes() {
final AnnotatedType<?> at = transformer.getEnhancedAnnotatedType(new Possum().procreate().getClass(), AnnotatedTypeIdentifier.NULL_BDA_ID);
transformer.getEnhancedAnnotatedType(new ForwardingAnnotatedType() {
@Override
public AnnotatedType delegate() {
return at;
}
}, AnnotatedTypeIdentifier.NULL_BDA_ID);
}
Aggregations