private ContainerType getContainerType(XMember member, ReflectionManager reflectionManager) {
   if (!member.isAnnotationPresent(IndexedEmbedded.class)) {
     return ContainerType.SINGLE;
   }
   if (member.isArray()) {
     return ContainerType.ARRAY;
   }
   Class<?> typeClass = reflectionManager.toClass(member.getType());
   if (Iterable.class.isAssignableFrom(typeClass)) {
     return ContainerType.ITERABLE;
   }
   if (member.isCollection() && Map.class.equals(member.getCollectionClass())) {
     return ContainerType.MAP;
   }
   // marked @IndexedEmbedded but not a container
   // => probably a @Field @IndexedEmbedded Foo foo;
   return ContainerType.SINGLE;
 }
  /**
   * Constructor.
   *
   * @param xClass The class for which to build a document builder
   * @param typeMetadata metadata for the specified class
   * @param reflectionManager Reflection manager to use for processing the annotations
   * @param optimizationBlackList keeps track of types on which we need to disable collection events
   *     optimizations
   * @param instanceInitializer a {@link org.hibernate.search.spi.InstanceInitializer} object.
   */
  public AbstractDocumentBuilder(
      XClass xClass,
      TypeMetadata typeMetadata,
      ReflectionManager reflectionManager,
      Set<XClass> optimizationBlackList,
      InstanceInitializer instanceInitializer) {
    if (xClass == null) {
      throw new AssertionFailure(
          "Unable to build a DocumentBuilderContainedEntity with a null class");
    }

    this.instanceInitializer = instanceInitializer;
    this.entityState = EntityState.CONTAINED_IN_ONLY;
    this.beanXClass = xClass;
    this.beanClass = reflectionManager.toClass(xClass);
    this.typeMetadata = typeMetadata;

    optimizationBlackList.addAll(typeMetadata.getOptimizationBlackList());
  }
  /**
   * This extracts and instantiates the implementation class from a ClassBridge annotation.
   *
   * @param fieldBridgeAnnotation the FieldBridge annotation
   * @param appliedOnType the type the bridge is applied on
   * @param reflectionManager The reflection manager instance
   * @return FieldBridge
   */
  private FieldBridge extractType(
      org.hibernate.search.annotations.FieldBridge fieldBridgeAnnotation,
      XClass appliedOnType,
      ReflectionManager reflectionManager) {
    FieldBridge bridge = null;

    if (fieldBridgeAnnotation != null) {
      bridge =
          doExtractType(
              fieldBridgeAnnotation,
              appliedOnType.getName(),
              reflectionManager.toClass(appliedOnType));
    }

    if (bridge == null) {
      throw LOG.unableToDetermineClassBridge(appliedOnType.getName());
    }

    return bridge;
  }
 private FieldBridge doExtractType(
     org.hibernate.search.annotations.FieldBridge bridgeAnn,
     XMember member,
     ReflectionManager reflectionManager) {
   return doExtractType(bridgeAnn, member.getName(), reflectionManager.toClass(member.getType()));
 }