com.googlecode.objectify.impl.save
Class FieldSaver

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

public abstract class FieldSaver
extends java.lang.Object
implements Saver

Most savers are related to a particular type of field. This provides a convenient base class.


Constructor Summary
FieldSaver(java.lang.Class<?> examinedClass, java.lang.reflect.Field field, boolean ignoreClassIndexing, boolean collectionize)
           
 
Method Summary
 void save(java.lang.Object pojo, com.google.appengine.api.datastore.Entity entity, Path path, boolean index)
          Saves the part of a pojo that we are responsible for to an entity.
protected abstract  void saveValue(java.lang.Object value, com.google.appengine.api.datastore.Entity entity, Path path, boolean index)
          Actually save the value in the entity.
protected  void setEntityProperty(com.google.appengine.api.datastore.Entity entity, java.lang.Object value, Path path, boolean index)
          Sets property on the entity correctly for the values of this.path and this.indexed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldSaver

public FieldSaver(java.lang.Class<?> examinedClass,
                  java.lang.reflect.Field field,
                  boolean ignoreClassIndexing,
                  boolean collectionize)
Parameters:
examinedClass - is the class which is being registered (or embedded). It posesses the field, but it is not necessarily the declaring class (which could be a base class).
ignoreClassIndexing - if true will prevent the declaring class of this field from having an effect on indexing via its @Indexed/@Unindexed
collectionize - is whether or not the elements of this field should be stored in a collection; this is used for embedded collection class fields.
Method Detail

save

public final void save(java.lang.Object pojo,
                       com.google.appengine.api.datastore.Entity entity,
                       Path path,
                       boolean index)
Description copied from interface: Saver
Saves the part of a pojo that we are responsible for to an entity.

Specified by:
save in interface Saver
Parameters:
pojo - might be a root pojo or it might be an embedded class.
path - is the entity path to this class, ie "field1.field2" for an embedded field1 containing a field2 of the type of this class. The root pathPrefix is null.
index - whether or not the parent thinks this value should be indexed when saved.

saveValue

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

Parameters:
path - TODO

setEntityProperty

protected void setEntityProperty(com.google.appengine.api.datastore.Entity entity,
                                 java.lang.Object value,
                                 Path path,
                                 boolean index)
Sets property on the entity correctly for the values of this.path and this.indexed.

Parameters:
path - TODO


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