com.googlecode.objectify.impl.load
Class EmbeddedMultivalueSetter

java.lang.Object
  extended by com.googlecode.objectify.impl.load.Setter
      extended by com.googlecode.objectify.impl.load.CollisionDetectingSetter
          extended by com.googlecode.objectify.impl.load.EmbeddedMultivalueSetter
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
EmbeddedArraySetter, EmbeddedCollectionSetter

public abstract class EmbeddedMultivalueSetter
extends CollisionDetectingSetter

This is a base class for handling setter operations on collections and arrays.


Constructor Summary
EmbeddedMultivalueSetter(java.lang.reflect.Field field, java.lang.String path, java.util.Collection<java.lang.String> collisionPaths)
           
 
Method Summary
protected abstract  java.lang.reflect.Constructor<?> getComponentConstructor()
           
protected abstract  java.util.Collection<java.lang.Object> getOrCreateCollection(java.lang.Object toPojo, int size)
          Gets the collection in the relevant field of the specified POJO, or creates (and sets) a new one.
protected  void safeSet(java.lang.Object toPojo, java.lang.Object value, LoadContext context)
          Just like set() but called after collision detection is performed.
 
Methods inherited from class com.googlecode.objectify.impl.load.CollisionDetectingSetter
set
 
Methods inherited from class com.googlecode.objectify.impl.load.Setter
clone, extend, getNext
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedMultivalueSetter

public EmbeddedMultivalueSetter(java.lang.reflect.Field field,
                                java.lang.String path,
                                java.util.Collection<java.lang.String> collisionPaths)
Method Detail

getComponentConstructor

protected abstract java.lang.reflect.Constructor<?> getComponentConstructor()
Returns:
the no-arg constructor of the embedded type

getOrCreateCollection

protected abstract java.util.Collection<java.lang.Object> getOrCreateCollection(java.lang.Object toPojo,
                                                                                int size)
Gets the collection in the relevant field of the specified POJO, or creates (and sets) a new one. If the field is an array type, set it up and return a Collection facade of the array.

Parameters:
toPojo - is the entity pojo that has a field for us to set
size - is the size of the pojo to create, if necessary

safeSet

protected void safeSet(java.lang.Object toPojo,
                       java.lang.Object value,
                       LoadContext context)
Description copied from class: CollisionDetectingSetter
Just like set() but called after collision detection is performed.

Specified by:
safeSet in class CollisionDetectingSetter


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