public class ArrayTranslatorFactory extends Object implements TranslatorFactory<Object,List<? extends com.google.cloud.datastore.Value<?>>>
Translator which can load an array of things.
Note that empty or null arrays are not stored in the datastore, and null values for the array 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 array contents.
The reason the generic P type of this factory is Object instead of Object[] is that Object[] is incompatible with the primitive arrays. This factory handles primitives as well.
CollectionTranslatorFactory
Constructor and Description |
---|
ArrayTranslatorFactory() |
Modifier and Type | Method and Description |
---|---|
Translator<Object,List<? extends com.google.cloud.datastore.Value<?>>> |
create(TypeKey<Object> tk,
CreateContext ctx,
Path path)
Create a translator for a type.
|
public Translator<Object,List<? extends com.google.cloud.datastore.Value<?>>> create(TypeKey<Object> tk, CreateContext ctx, Path path)
TranslatorFactory
create
in interface TranslatorFactory<Object,List<? extends com.google.cloud.datastore.Value<?>>>
tk
- defines the type which is to be translatedpath
- is where this type was discovered, important for logging and exceptionsCopyright © 2018. All rights reserved.