public class NumberTranslatorFactory extends Object implements TranslatorFactory<Number>
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.
Constructor and Description |
---|
NumberTranslatorFactory() |
public ValueTranslator<Number,Object> create(Path path, Property property, Type type, CreateContext ctx)
create
in interface TranslatorFactory<Number>
path
- current path to this part of the tree, important for logging and exceptionsproperty
- is the property we are inspecting to create a translator fortype
- is the generic type of the field (or field component). For example, examining a field of type
ListCopyright © 2014. All rights reserved.