public Map<Type, Type> build(final Set<Type> types) {
Checker.notNull("parameter:types", types);
final Map<Type, List<Match>> accumulator = new HashMap<Type, List<Match>>();
final ConcreteTypesImplementingInterfaceVisitor visitor = new ConcreteTypesImplementingInterfaceVisitor() {
@Override
protected boolean visit(final Type readerOrWriter) {
final Map<Type, Match> matches = ObjectReaderOrWriterFinder.this.findMatchingType(readerOrWriter);
while (true) {
// nothing to do...
if (matches.isEmpty()) {
break;
}
// check if any of the matched types overlap any of the
// serializedtypes.. if result is none do nothing...
if (false == ObjectReaderOrWriterFinder.this.findSingleMatch(matches, types)) {
break;
}
ObjectReaderOrWriterFinder.this.mergeMatches(matches, accumulator);
break;
}
return false;
}
@Override
protected boolean skipAbstractTypes() {
return true;
}
};
final Type readerOrWriterInterface = this.getImplementingInterface();
visitor.start(readerOrWriterInterface);
return this.finalizeBindings(accumulator);
}