com.googlecode.objectify.impl.load
Class EmbeddedArraySetter

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
              extended by com.googlecode.objectify.impl.load.EmbeddedArraySetter
All Implemented Interfaces:
java.lang.Cloneable

public class EmbeddedArraySetter
extends EmbeddedMultivalueSetter

This setter handles an embedded array by constructing the array and all the objects inside. It expects the value to be a collection type so it "fans out" the values to all the embedded objects in the array, calling the next setter in the chain with each value.


Constructor Summary
EmbeddedArraySetter(java.lang.reflect.Field field, java.lang.String path, java.util.Collection<java.lang.String> collisionPaths)
           
 
Method Summary
protected  java.lang.reflect.Constructor<?> getComponentConstructor()
           
protected  java.util.Collection<java.lang.Object> getOrCreateCollection(java.lang.Object onPojo, int size)
          Gets the collection in the relevant field of the specified POJO, or creates (and sets) a new one.
 
Methods inherited from class com.googlecode.objectify.impl.load.EmbeddedMultivalueSetter
safeSet
 
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

EmbeddedArraySetter

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

getComponentConstructor

protected java.lang.reflect.Constructor<?> getComponentConstructor()
Specified by:
getComponentConstructor in class EmbeddedMultivalueSetter
Returns:
the no-arg constructor of the embedded type

getOrCreateCollection

protected java.util.Collection<java.lang.Object> getOrCreateCollection(java.lang.Object onPojo,
                                                                       int size)
Description copied from class: EmbeddedMultivalueSetter
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.

Specified by:
getOrCreateCollection in class EmbeddedMultivalueSetter
Parameters:
onPojo - is the entity pojo that has a field for us to set
size - is the size of the pojo to create, if necessary


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