use of javax.enterprise.inject.spi.AnnotatedType in project kie-wb-common by kiegroup.
the class ControllerExtensionTest method createAnnotatedType.
protected ProcessAnnotatedType createAnnotatedType(final Class aClass) {
final ProcessAnnotatedType processAnnotatedType = mock(ProcessAnnotatedType.class);
final AnnotatedType annotatedType = mock(AnnotatedType.class);
when(processAnnotatedType.getAnnotatedType()).thenReturn(annotatedType);
when(annotatedType.getJavaClass()).thenReturn(aClass);
return processAnnotatedType;
}
use of javax.enterprise.inject.spi.AnnotatedType in project core by weld.
the class JsonObjectsTest method getFooAnnotatedMethod.
private static AnnotatedMethod<Foo> getFooAnnotatedMethod(String name) {
final Method method = findDeclaredFooMethod(name);
return new AnnotatedMethod<Foo>() {
@Override
public List<AnnotatedParameter<Foo>> getParameters() {
Type[] paramTypes = method.getGenericParameterTypes();
if (paramTypes.length == 0) {
return Collections.emptyList();
}
List<AnnotatedParameter<Foo>> params = new ArrayList<>();
for (int i = 0; i < paramTypes.length; i++) {
final Type baseType = paramTypes[i];
final Annotation[] annotations = method.getParameterAnnotations()[i];
params.add(new AnnotatedParameter<Foo>() {
@Override
public Type getBaseType() {
return baseType;
}
@Override
public Set<Type> getTypeClosure() {
throw new UnsupportedOperationException();
}
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
throw new UnsupportedOperationException();
}
@Override
public Set<Annotation> getAnnotations() {
return new HashSet<>(Arrays.asList(annotations));
}
@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
throw new UnsupportedOperationException();
}
@Override
public int getPosition() {
throw new UnsupportedOperationException();
}
@Override
public AnnotatedCallable<Foo> getDeclaringCallable() {
throw new UnsupportedOperationException();
}
});
}
return params;
}
@Override
public boolean isStatic() {
throw new UnsupportedOperationException();
}
@Override
public AnnotatedType<Foo> getDeclaringType() {
return new AnnotatedType<Foo>() {
@Override
public Type getBaseType() {
throw new UnsupportedOperationException();
}
@Override
public Set<Type> getTypeClosure() {
throw new UnsupportedOperationException();
}
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
throw new UnsupportedOperationException();
}
@Override
public Set<Annotation> getAnnotations() {
throw new UnsupportedOperationException();
}
@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
throw new UnsupportedOperationException();
}
@Override
public Class<Foo> getJavaClass() {
return Foo.class;
}
@Override
public Set<AnnotatedConstructor<Foo>> getConstructors() {
throw new UnsupportedOperationException();
}
@Override
public Set<AnnotatedMethod<? super Foo>> getMethods() {
throw new UnsupportedOperationException();
}
@Override
public Set<AnnotatedField<? super Foo>> getFields() {
throw new UnsupportedOperationException();
}
};
}
@Override
public Type getBaseType() {
throw new UnsupportedOperationException();
}
@Override
public Set<Type> getTypeClosure() {
throw new UnsupportedOperationException();
}
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
throw new UnsupportedOperationException();
}
@Override
public Set<Annotation> getAnnotations() {
return new HashSet<>(Arrays.asList(method.getAnnotations()));
}
@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
throw new UnsupportedOperationException();
}
@Override
public Method getJavaMember() {
return method;
}
};
}
use of javax.enterprise.inject.spi.AnnotatedType 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 javax.enterprise.inject.spi.AnnotatedType 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 javax.enterprise.inject.spi.AnnotatedType 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