Class NumberTranslatorFactory
java.lang.Object
com.googlecode.objectify.impl.translate.NumberTranslatorFactory
- All Implemented Interfaces:
TranslatorFactory<Number,Object>
public class NumberTranslatorFactory extends Object implements TranslatorFactory<Number,Object>
Numbers are funky in the datastore. You can save numbers of any size, but they always retrieve as Long. For the hell of it, we also handle String in the datastore by trying to parse it.
Not a ValueTranslatorFactory because Numbers are not assignable to primitives. Java lame.
- Author:
- Jeff Schnitzer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate(TypeKey<Number> tk, CreateContext ctx, Path path)
Create a translator for a type.
-
Constructor Details
-
NumberTranslatorFactory
public NumberTranslatorFactory()
-
-
Method Details
-
create
Description copied from interface:TranslatorFactory
Create a translator for a type.- Specified by:
create
in interfaceTranslatorFactory<Number,Object>
- 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.
-