/**
  * A {@code XMember } instance treats a map as a collection as well in which case the map values
  * are returned as collection.
  *
  * @param member The member instance
  * @param value The value
  * @return The {@code value} cast to collection or in case of {@code value} being a map the map
  *     values as collection.
  */
 @SuppressWarnings("unchecked")
 private <T> Collection<T> getActualCollection(XMember member, Object value) {
   Collection<T> collection;
   if (Map.class.equals(member.getCollectionClass())) {
     collection = ((Map<?, T>) value).values();
   } else {
     collection = (Collection<T>) value;
   }
   return collection;
 }
 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;
 }