Class Translators

java.lang.Object
com.googlecode.objectify.impl.translate.Translators

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.

Author:
Jeff Schnitzer invalid input: '<'[email protected]>
  • Constructor Details

    • Translators

      public Translators(ObjectifyFactory fact)
      Initialize the default set of converters in the proper order.
  • Method Details

    • add

      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.

    • addEarly

      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.

    • get

      public <P, D> Translator<P,D> get(TypeKey tk, CreateContext ctx, Path path)
      Obtains the Translator appropriate for this type and annotations. May be a cached translator; if not, one will be discovered and cached.
    • getRoot

      public <P> Translator<P,com.google.cloud.datastore.FullEntity<?>> getRoot(Class<P> clazz)
      Get the translator for a root entity class