Class CollectionTranslatorFactory
java.lang.Object
com.googlecode.objectify.impl.translate.CollectionTranslatorFactory
- All Implemented Interfaces:
TranslatorFactory<Collection<Object>,Collection<Object>>
public class CollectionTranslatorFactory extends Object implements TranslatorFactory<Collection<Object>,Collection<Object>>
Translator which can load things into a collection field. Those things are themselves translated.
This translator is clever about recycling an existing collection in the POJO field when loading. That way a collection that has been initialized with a sort (or other data) will remain intact.
Note that empty or null collections are not stored in the datastore, and null values for the collection field are ignored when they are loaded from the Entity. This is because the datastore doesn't store empty collections, and storing null fields will confuse filtering for actual nulls in the collection contents.
- Author:
- Jeff Schnitzer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate(TypeKey<Collection<Object>> tk, CreateContext ctx, Path path)
Create a translator for a type.
-
Constructor Details
-
CollectionTranslatorFactory
public CollectionTranslatorFactory()
-
-
Method Details
-
create
public Translator<Collection<Object>,Collection<Object>> create(TypeKey<Collection<Object>> tk, CreateContext ctx, Path path)Description copied from interface:TranslatorFactory
Create a translator for a type.- Specified by:
create
in interfaceTranslatorFactory<Collection<Object>,Collection<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.
-