stringifierClass = KeyStringifier.class;
if (stringifierClass == null)
throw new IllegalStateException("Embedded Map keys must be of type String/Enum/Key<?> or field must specify @Stringify");
final ObjectifyFactory fact = ctx.getFactory();
@SuppressWarnings("unchecked")
final Stringifier<Object> stringifier = (Stringifier<Object>)fact.construct(stringifierClass);
if (stringifier instanceof InitializeStringifier)
((InitializeStringifier)stringifier).init(fact, keyType);
Type componentType = GenericUtils.getMapValueType(tk.getType());
final Translator<Object, Object> componentTranslator = fact.getTranslators().get(new TypeKey<>(componentType, tk), ctx, path);
return new TranslatorRecycles<Map<Object,Object>, EmbeddedEntity>() {
@Override
public Map<Object, Object> loadInto(EmbeddedEntity node, LoadContext ctx, Path path, Map<Object, Object> into) {
// Make this work more like collections than atomic values
if (node == null)
throw new SkipException();
if (into == null)
//noinspection unchecked
into = (Map<Object, Object>)fact.constructMap(mapType);
else
into.clear();
for (Map.Entry<String, Object> entry: node.getProperties().entrySet()) {
Object key = stringifier.fromString(entry.getKey());