Class ClassTranslator<P>
java.lang.Object
com.googlecode.objectify.impl.translate.NullSafeTranslator<P,com.google.cloud.datastore.FullEntity<?>>
com.googlecode.objectify.impl.translate.ClassTranslator<P>
- All Implemented Interfaces:
Translator<P,
com.google.cloud.datastore.FullEntity<?>>
public class ClassTranslator<P>
extends NullSafeTranslator<P,com.google.cloud.datastore.FullEntity<?>>
Some common code for Translators which know how to convert a POJO type into a PropertiesContainer. This might be polymorphic; we get polymorphism when @Subclasses are registered on this translator.
- Author:
- Jeff Schnitzer invalid input: '<'[email protected]>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOnly works on @Entity classesloadSafe
(com.google.cloud.datastore.Value<com.google.cloud.datastore.FullEntity<?>> container, LoadContext ctx, Path path) Implement this, returning a proper translated valuevoid
registerSubclass
(ClassTranslator<? extends P> translator) Register a subclass translator with this class translator.com.google.cloud.datastore.Value
<com.google.cloud.datastore.FullEntity<?>> saveSafe
(P pojo, boolean index, SaveContext ctx, Path path) Implement this, returning a proper translated valueMethods inherited from class com.googlecode.objectify.impl.translate.NullSafeTranslator
load, save
-
Field Details
-
DISCRIMINATOR_PROPERTY
Name of the out-of-band discriminator property in a PropertyContainer- See Also:
-
DISCRIMINATOR_INDEX_PROPERTY
Name of the list property which will hold all indexed discriminator values- See Also:
-
-
Constructor Details
-
ClassTranslator
-
-
Method Details
-
loadSafe
public P loadSafe(com.google.cloud.datastore.Value<com.google.cloud.datastore.FullEntity<?>> container, LoadContext ctx, Path path) throws SkipException Description copied from class:NullSafeTranslator
Implement this, returning a proper translated value- Specified by:
loadSafe
in classNullSafeTranslator<P,
com.google.cloud.datastore.FullEntity<?>> - Parameters:
container
- will never be null or NullValue- Throws:
SkipException
-
saveSafe
public com.google.cloud.datastore.Value<com.google.cloud.datastore.FullEntity<?>> saveSafe(P pojo, boolean index, SaveContext ctx, Path path) throws SkipException Description copied from class:NullSafeTranslator
Implement this, returning a proper translated value- Specified by:
saveSafe
in classNullSafeTranslator<P,
com.google.cloud.datastore.FullEntity<?>> - Parameters:
pojo
- will never be null- Throws:
SkipException
-
registerSubclass
Register a subclass translator with this class translator. That way if we get called upon to translate an instance of the subclass, we will forward to the correct translator. -
getKeyMetadata
Only works on @Entity classes
-