use of org.qi4j.api.structure.MetaInfoHolder in project qi4j-sdk by Qi4j.
the class InstanceImporter method importService.
@Override
public T importService(final ImportedServiceDescriptor serviceDescriptor) throws ServiceImporterException {
T instance = null;
Iterable<MetaInfoHolder> holders = Iterables.iterable(serviceDescriptor, module, layer, application);
for (final MetaInfoHolder metaInfoHolder : holders) {
Function<Class<?>, T> metaFinder = new Function<Class<?>, T>() {
@Override
@SuppressWarnings("unchecked")
public T map(Class<?> type) {
return (T) metaInfoHolder.metaInfo(type);
}
};
instance = first(filter(notNull(), map(metaFinder, serviceDescriptor.types())));
if (instance != null) {
break;
}
}
return instance;
}
Aggregations