public class Translators extends Object
Manages all the translators used to map between POJO fields and the types that the Datastore can actually persist. Essentially acts as an aggregator for all the TranslatorFactory objects.
When Objectify arranges a translator for a type at registration time, it runs through the available TranslatorFactory instances one at time looking for one that will provide a Translator. The first one found is kept and used during runtime assembly and disassembly of entities.
Constructor and Description |
---|
Translators(ObjectifyFactory fact)
Initialize the default set of converters in the proper order.
|
Modifier and Type | Method and Description |
---|---|
void |
add(TranslatorFactory<?,?> trans)
Add a new translator to the list.
|
void |
addEarly(TranslatorFactory<?,?> trans)
Add a new translator to the beginning of the list, before all other translators
except other translators that have been added early.
|
<P,D> Translator<P,D> |
get(TypeKey tk,
CreateContext ctx,
Path path)
Obtains the Translator appropriate for this type and annotations.
|
<P> Translator<P,com.google.appengine.api.datastore.PropertyContainer> |
getRoot(Class<P> clazz)
Get the translator for a root entity class
|
public Translators(ObjectifyFactory fact)
public void add(TranslatorFactory<?,?> trans)
Add a new translator to the list. Translators are added in order after most of the "plumbing" translators (collections, arrays, maps, serialize, embeds, references) but before any of the standard value conversions like String, Number, Key, Enum, SqlDate, TimeZone, etc.
Translators are added in-order so earlier translaters pre-empt later translators.
public void addEarly(TranslatorFactory<?,?> trans)
Add a new translator to the beginning of the list, before all other translators except other translators that have been added early.
public <P,D> Translator<P,D> get(TypeKey tk, CreateContext ctx, Path path)
public <P> Translator<P,com.google.appengine.api.datastore.PropertyContainer> getRoot(Class<P> clazz)
Copyright © 2016. All rights reserved.