Class ValueTranslatorFactory<P,​D>

java.lang.Object
com.googlecode.objectify.impl.translate.ValueTranslatorFactory<P,​D>
All Implemented Interfaces:
TranslatorFactory<P,​D>
Direct Known Subclasses:
BigDecimalLongTranslatorFactory, BigMoneyStringTranslatorFactory, ByteArrayTranslatorFactory, DateTimeZoneTranslatorFactory, EnumTranslatorFactory, KeyTranslatorFactory, MoneyStringTranslatorFactory, ReadableInstantTranslatorFactory, ReadablePartialTranslatorFactory, RefTranslatorFactory, SqlDateTranslatorFactory, StringTranslatorFactory, TextTranslatorFactory, TimeZoneTranslatorFactory, URLTranslatorFactory

public abstract class ValueTranslatorFactory<P,​D>
extends Object
implements TranslatorFactory<P,​D>
Provides a little boilerplate for translators that work on simple atomic types.
Author:
Jeff Schnitzer
  • Constructor Details

    • ValueTranslatorFactory

      protected ValueTranslatorFactory(Class<? extends P> pojoType)
  • Method Details

    • create

      public final Translator<P,​D> create(TypeKey<P> tk, CreateContext ctx, Path path)
      Description copied from interface: TranslatorFactory
      Create a translator for a type.
      Specified by:
      create in interface TranslatorFactory<P,​D>
      Parameters:
      tk - defines the type which is to be translated
      path - is where this type was discovered, important for logging and exceptions
      Returns:
      null if this factory does not know how to deal with that situation.
    • createValueTranslator

      protected abstract ValueTranslator<P,​D> createValueTranslator(TypeKey<P> tk, CreateContext ctx, Path path)
      Create a translator, knowing that we have the appropriate type. You don't need to check for type matching.
      Parameters:
      tk - type is guaranteed to erase to something assignable to Class