Class ValueTranslatorFactory<P,D>
- java.lang.Object
-
- com.googlecode.objectify.impl.translate.ValueTranslatorFactory<P,D>
-
- All Implemented Interfaces:
TranslatorFactory<P,D>
- Direct Known Subclasses:
EnumTranslatorFactory
,ReadableInstantTranslatorFactory
,ReadablePartialTranslatorFactory
,RefTranslatorFactory
,SimpleTranslatorFactory
public abstract class ValueTranslatorFactory<P,D> extends Object implements TranslatorFactory<P,D>
Provides a little boilerplate for translators that work on simple atomic types. Automatically wraps primitives so we don't have to worry about them. Handles indexing for us.- Author:
- Jeff Schnitzer
-
-
Constructor Summary
Constructors Constructor Description ValueTranslatorFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Translator<P,D>
create(TypeKey<P> tk, CreateContext ctx, Path path)
Create a translator for a type.protected abstract ValueTranslator<P,D>
createValueTranslator(TypeKey<P> tk, CreateContext ctx, Path path)
Create a translator, knowing that we have the appropriate type.
-
-
-
Method Detail
-
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 interfaceTranslatorFactory<P,D>
- Parameters:
tk
- defines the type which is to be translatedpath
- 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
-
-