use of org.qi4j.api.sideeffect.SideEffects in project qi4j-sdk by Qi4j.
the class CompositeAssemblyImpl method sideEffectDeclarations.
protected Iterable<Class<?>> sideEffectDeclarations(ArrayList<Type> allTypes) {
// Find all side-effects and flattern them into an iterable
Function<Type, Iterable<Class<?>>> function = new Function<Type, Iterable<Class<?>>>() {
@Override
public Iterable<Class<?>> map(Type type) {
SideEffects sideEffects = Annotations.annotationOn(type, SideEffects.class);
if (sideEffects == null) {
return empty();
} else {
return iterable(sideEffects.value());
}
}
};
Iterable<Class<?>> flatten = flattenIterables(map(function, allTypes));
return toList(flatten);
}
use of org.qi4j.api.sideeffect.SideEffects in project qi4j-sdk by Qi4j.
the class CompositeAssemblyImpl method sideEffectDeclarations.
protected Iterable<Class<?>> sideEffectDeclarations(Iterable<? extends Class<?>> typess) {
// Find side-effect declarations
ArrayList<Type> allTypes = new ArrayList<Type>();
for (Class<?> type : typess) {
Iterable<Type> types = typesOf(type);
Iterables.addAll(allTypes, types);
}
// Find all side-effects and flattern them into an iterable
Function<Type, Iterable<Class<?>>> function = new Function<Type, Iterable<Class<?>>>() {
@Override
public Iterable<Class<?>> map(Type type) {
SideEffects sideEffects = Annotations.annotationOn(type, SideEffects.class);
if (sideEffects == null) {
return Iterables.empty();
} else {
return iterable(sideEffects.value());
}
}
};
Iterable<Class<?>> flatten = Iterables.flattenIterables(Iterables.map(function, allTypes));
return Iterables.toList(flatten);
}
use of org.qi4j.api.sideeffect.SideEffects in project qi4j-sdk by Qi4j.
the class AnnotationsTest method getAnnotationOrNull.
@Test
public void getAnnotationOrNull() throws NoSuchMethodException {
assertNotNull("Mixins annotation found", Annotations.annotationOn(AnnotatedClass.class, Mixins.class));
assertNull("No SideEffects annotation found", Annotations.annotationOn(AnnotatedClass.class, SideEffects.class));
final Type returnType = AnnotatedClass.class.getDeclaredMethod("list").getGenericReturnType();
assertNull("Null on no class type", Annotations.annotationOn(returnType, Mixins.class));
}
Aggregations