public class BigDecimalEmbeddedEntityTranslatorFactory extends Object implements com.googlecode.objectify.impl.translate.TranslatorFactory<BigDecimal,com.google.appengine.api.datastore.EmbeddedEntity>
This a more advanced strategy for storing java.math.BigDecimal in the datastore than the standard Objectify
translators. This implementation encodes the BigDecimal value and stores the result as a String.
This is appropriate for monetary and other values of ~475 digits (the end encoded value length is number dependent).
This strategy offers the following advantages over encoding a java.math.BigDecimal as a Long:
For more details, read this blog entry: "http://softwareblog.sappenin.com/2014/05/best-practices-for-storing-bigdecimal.html"
This translator is not installed by default, but can be installed as follows:
ObjectifyService.factory().getTranslators().add(new BigDecimalStringTranslatorFactory());
| Constructor and Description |
|---|
BigDecimalEmbeddedEntityTranslatorFactory() |
| Modifier and Type | Method and Description |
|---|---|
com.googlecode.objectify.impl.translate.Translator<BigDecimal,com.google.appengine.api.datastore.EmbeddedEntity> |
create(com.googlecode.objectify.impl.translate.TypeKey<BigDecimal> tk,
com.googlecode.objectify.impl.translate.CreateContext ctx,
com.googlecode.objectify.impl.Path path) |
public BigDecimalEmbeddedEntityTranslatorFactory()
public com.googlecode.objectify.impl.translate.Translator<BigDecimal,com.google.appengine.api.datastore.EmbeddedEntity> create(com.googlecode.objectify.impl.translate.TypeKey<BigDecimal> tk, com.googlecode.objectify.impl.translate.CreateContext ctx, com.googlecode.objectify.impl.Path path)
create in interface com.googlecode.objectify.impl.translate.TranslatorFactory<BigDecimal,com.google.appengine.api.datastore.EmbeddedEntity>Copyright © 2013-2014–2015 Sappenin Inc.. All rights reserved.