com.googlecode.objectify.impl.save
Class EmbeddedMultivalueFieldSaver

java.lang.Object
  extended by com.googlecode.objectify.impl.save.FieldSaver
      extended by com.googlecode.objectify.impl.save.EmbeddedMultivalueFieldSaver
All Implemented Interfaces:
Saver
Direct Known Subclasses:
EmbeddedArrayFieldSaver, EmbeddedCollectionFieldSaver

public abstract class EmbeddedMultivalueFieldSaver
extends FieldSaver

Base class for EmbeddedArrayFieldSaver and EmbeddedCollectionFieldSaver that handles most of the logic. The subclasses need only understand how to get the component type and how to make an iterator.


Constructor Summary
EmbeddedMultivalueFieldSaver(Conversions conv, java.lang.Class<?> examinedClass, java.lang.reflect.Field field, boolean ignoreClassIndexing, boolean collectionize)
           
 
Method Summary
protected abstract  java.util.Collection<java.lang.Object> asCollection(java.lang.Object arrayOrCollection)
          Gets an iterator from the array or collection passed in
protected abstract  java.lang.Class<?> getComponentType()
          Gets the component type of the field
 void saveValue(java.lang.Object value, com.google.appengine.api.datastore.Entity entity, Path path, boolean index)
          Actually save the value in the entity.
 
Methods inherited from class com.googlecode.objectify.impl.save.FieldSaver
save, setEntityProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedMultivalueFieldSaver

public EmbeddedMultivalueFieldSaver(Conversions conv,
                                    java.lang.Class<?> examinedClass,
                                    java.lang.reflect.Field field,
                                    boolean ignoreClassIndexing,
                                    boolean collectionize)
Parameters:
field - must be an array type
ignoreClassIndexing - see the FieldSaver javadocs
collectionize - must always be false because we cannot nest embedded arrays or collections. This parameter is here so that it is always passed in the code, never forgotten, and will always generate the appropriate runtime error.
Method Detail

getComponentType

protected abstract java.lang.Class<?> getComponentType()
Gets the component type of the field


asCollection

protected abstract java.util.Collection<java.lang.Object> asCollection(java.lang.Object arrayOrCollection)
Gets an iterator from the array or collection passed in


saveValue

public final void saveValue(java.lang.Object value,
                            com.google.appengine.api.datastore.Entity entity,
                            Path path,
                            boolean index)
Description copied from class: FieldSaver
Actually save the value in the entity. This is the real value, already obtained from the POJO and checked against the @Unsaved mechanism..

Specified by:
saveValue in class FieldSaver
path - TODO


Copyright © 2011 Jeff Schnitzer and a gang of pirates. All Rights Reserved. Build version: 3.1