/**
  * @param annotatedElement an annotated element
  * @return a string which identifies the location/point the annotation was placed on. Something of
  *     the form package.[[className].[field|member]]
  */
 private String buildAnnotationDefinitionPoint(XAnnotatedElement annotatedElement) {
   if (annotatedElement instanceof XClass) {
     return ((XClass) annotatedElement).getName();
   } else if (annotatedElement instanceof XMember) {
     XMember member = (XMember) annotatedElement;
     return member.getType().getName() + '.' + member.getName();
   } else if (annotatedElement instanceof XPackage) {
     return ((XPackage) annotatedElement).getName();
   } else {
     throw new SearchException("Unknown XAnnotatedElement: " + annotatedElement);
   }
 }
 private FieldBridge doExtractType(
     org.hibernate.search.annotations.FieldBridge bridgeAnn,
     XMember member,
     ReflectionManager reflectionManager) {
   return doExtractType(bridgeAnn, member.getName(), reflectionManager.toClass(member.getType()));
 }
  public FieldBridge guessType(
      Field field,
      NumericField numericField,
      XMember member,
      ReflectionManager reflectionManager,
      ServiceManager serviceManager) {
    FieldBridge bridge = findExplicitFieldBridge(field, member, reflectionManager);
    if (bridge != null) {
      return bridge;
    }

    ExtendedBridgeProvider.ExtendedBridgeProviderContext context =
        new XMemberBridgeProviderContext(member, numericField, reflectionManager, serviceManager);
    ContainerType containerType = getContainerType(member, reflectionManager);

    // We do annotation based providers as Tike at least needs priority over
    // default providers because it might override the type for String
    // TODO: introduce the notion of bridge contributor annotations to cope with this in the future
    for (BridgeProvider provider : annotationBasedProviders) {
      bridge = getFieldBridgeFromBridgeProvider(provider, context, containerType);
      if (bridge != null) {
        return bridge;
      }
    }

    // walk through all regular bridges and if multiple match
    // raise an exception containing the conflicting bridges
    StringBuilder multipleMatchError = null;
    BridgeProvider initialMatchingBridgeProvider = null;
    for (BridgeProvider provider : regularProviders) {
      FieldBridge createdBridge =
          getFieldBridgeFromBridgeProvider(provider, context, containerType);
      if (createdBridge != null) {
        // oops we found a duplicate
        if (bridge != null) {
          // first duplicate, add the initial bridge
          if (multipleMatchError == null) {
            multipleMatchError =
                new StringBuilder("\n")
                    .append("FieldBridge: ")
                    .append(bridge)
                    .append(" - BridgeProvider: ")
                    .append(initialMatchingBridgeProvider.getClass());
          }
          multipleMatchError
              .append("\n")
              .append("FieldBridge: ")
              .append(createdBridge)
              .append(" - BridgeProvider: ")
              .append(provider.getClass());
        } else {
          bridge = createdBridge;
          initialMatchingBridgeProvider = provider;
        }
      }
    }
    if (multipleMatchError != null) {
      throw LOG.multipleMatchingFieldBridges(
          member, member.getType(), multipleMatchError.toString());
    }
    if (bridge != null) {
      return bridge;
    }

    throw LOG.unableToGuessFieldBridge(member.getType().getName(), member.getName());
  }