private FieldBridge doExtractType(
     org.hibernate.search.annotations.FieldBridge bridgeAnn,
     String appliedOnName,
     Class<?> appliedOnType) {
   assert bridgeAnn != null : "@FieldBridge instance cannot be null";
   FieldBridge bridge;
   Class<?> impl = bridgeAnn.impl();
   if (impl == void.class) {
     throw LOG.noImplementationClassInFieldBridge(appliedOnName);
   }
   try {
     Object instance = impl.newInstance();
     if (FieldBridge.class.isAssignableFrom(impl)) {
       bridge = (FieldBridge) instance;
     } else if (TwoWayStringBridge.class.isAssignableFrom(impl)) {
       bridge = new TwoWayString2FieldBridgeAdaptor((TwoWayStringBridge) instance);
     } else if (org.hibernate.search.bridge.StringBridge.class.isAssignableFrom(impl)) {
       bridge = new String2FieldBridgeAdaptor((org.hibernate.search.bridge.StringBridge) instance);
     } else {
       throw LOG.noFieldBridgeInterfaceImplementedByFieldBridge(impl.getName(), appliedOnName);
     }
     if (bridgeAnn.params().length > 0 && ParameterizedBridge.class.isAssignableFrom(impl)) {
       Map<String, String> params = new HashMap<String, String>(bridgeAnn.params().length);
       for (Parameter param : bridgeAnn.params()) {
         params.put(param.name(), param.value());
       }
       ((ParameterizedBridge) instance).setParameterValues(params);
     }
     populateReturnType(appliedOnType, impl, instance);
   } catch (Exception e) {
     throw LOG.unableToInstantiateFieldBridge(appliedOnName, appliedOnType.getName(), e);
   }
   return bridge;
 }
 /**
  * Injects any parameters configured via the given {@code ClassBridge} annotation into the given
  * object, in case this is a {@link ParameterizedBridge}.
  *
  * @param classBridgeConfiguration the parameter source
  * @param classBridge the object to inject the parameters into
  */
 public void injectParameters(ClassBridge classBridgeConfiguration, Object classBridge) {
   if (classBridgeConfiguration.params().length > 0
       && ParameterizedBridge.class.isAssignableFrom(classBridge.getClass())) {
     Map<String, String> params =
         new HashMap<String, String>(classBridgeConfiguration.params().length);
     for (Parameter param : classBridgeConfiguration.params()) {
       params.put(param.name(), param.value());
     }
     ((ParameterizedBridge) classBridge).setParameterValues(params);
   }
 }