// get the factory for the target type
final List<AdapterFactoryDescriptor> descList = factories.get(type.getName());
if (descList != null && descList.size() > 0) {
for (AdapterFactoryDescriptor desc : descList) {
final AdapterFactory factory = desc == null ? null : desc.getFactory();
// have the factory adapt the adaptable if the factory exists
if (factory != null) {
log.debug("Trying adapter factory {} to map {} to {}",
new Object [] { factory, adaptable, type });
AdapterType adaptedObject = factory.getAdapter(adaptable, type);
if (adaptedObject != null) {
log.debug("Using adapter factory {} to map {} to {}",
new Object [] { factory, adaptable, type });
return adaptedObject;
}