use of org.qi4j.api.concern.Concerns in project qi4j-sdk by Qi4j.
the class CompositeAssemblyImpl method concernDeclarations.
private Iterable<Class<?>> concernDeclarations(ArrayList<Type> allTypes) {
// Find all concerns and flattern them into an iterable
Function<Type, Iterable<Class<?>>> function = new Function<Type, Iterable<Class<?>>>() {
@Override
public Iterable<Class<?>> map(Type type) {
Concerns concerns = Annotations.annotationOn(type, Concerns.class);
if (concerns == null) {
return empty();
} else {
return iterable(concerns.value());
}
}
};
Iterable<Class<?>> flatten = flattenIterables(map(function, allTypes));
return toList(flatten);
}
use of org.qi4j.api.concern.Concerns in project qi4j-sdk by Qi4j.
the class CompositeAssemblyImpl method concernDeclarations.
private Iterable<Class<?>> concernDeclarations(Iterable<? extends Class<?>> typess) {
// Find concern declarations
ArrayList<Type> allTypes = new ArrayList<Type>();
for (Class<?> type : typess) {
Iterable<Type> types;
if (type.isInterface()) {
types = typesOf(type);
} else {
types = Iterables.<Type>cast(classHierarchy(type));
}
Iterables.addAll(allTypes, types);
}
// Find all concerns and flattern them into an iterable
Function<Type, Iterable<Class<?>>> function = new Function<Type, Iterable<Class<?>>>() {
@Override
public Iterable<Class<?>> map(Type type) {
Concerns concerns = Annotations.annotationOn(type, Concerns.class);
if (concerns == null) {
return Iterables.empty();
} else {
return iterable(concerns.value());
}
}
};
Iterable<Class<?>> flatten = Iterables.flattenIterables(Iterables.map(function, allTypes));
return Iterables.toList(flatten);
}
Aggregations