com.avaje.ebean.bean
Class SerializeControl

java.lang.Object
  extended by com.avaje.ebean.bean.SerializeControl

public class SerializeControl
extends Object

    

This is ONLY used for subclassed entity beans.

This is NOT USED for entity beans that are enhanced via a javaagent or ant task etc. This is only used when the entity beans are created as a subclass of the original class.

Allows the developer to control whether beans and collections are serialized to plain 'vanilla' classes or left in byte code generated subclasses.

Vanilla beans are beans that have plain ordinary classes as opposed to specially generated classes that Ebean creates. Ebean creates classes (using ASM) to support lazy loading (reference beans) and concurrency checking etc.

SerializeControl gives you the ability to control whether an object graph is serialized to plain 'vanilla' objects or in the special byte code generated form. There are pros and cons for both approaches depending on whether you want to support "FULL" concurrency checking and lazy loading when the object graph is deserialized.

Note that BeanMap, BeanList and BeanSet are not byte code generated. They are ordinary classes. However you may wish to have these serialized to the underlying List Set and Map implementations for the benefit that they can be deserialised in a JVM without ANY ebean code at all.


Constructor Summary
SerializeControl()
           
 
Method Summary
static boolean isVanillaBeans()
          Return true if beans are serialized to Vanilla as opposed to byte code generated subclasses.
static boolean isVanillaCollections()
          Return true if collections are serialized to be plain Lists Sets or Maps as opposed to BeanList, BeanMap or BeanSet.
static void resetToDefault()
          Reset the mode for beans and collections back to the JVM wide default setting.
static void setDefaultForBeans(boolean vanillaOn)
          Set the JVM wide default for Beans.
static void setDefaultForCollections(boolean vanillaOn)
          Set the JVM wide default for Collections.
static void setVanilla(boolean vanillaOn)
          Set the mode for both Beans and Collections.
static void setVanillaBeans(boolean vanillaOn)
          Set whether beans should be serialized to Vanilla as opposed to byte code generated subclasses.
static void setVanillaCollections(boolean vanillaOn)
          Set whether collections should be serialized to Vanilla Lists Sets or Maps (instead of BeanList, BeanMap or BeanSet).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializeControl

public SerializeControl()
Method Detail

setDefaultForBeans

public static void setDefaultForBeans(boolean vanillaOn)
Set the JVM wide default for Beans.


setDefaultForCollections

public static void setDefaultForCollections(boolean vanillaOn)
Set the JVM wide default for Collections.


resetToDefault

public static void resetToDefault()
Reset the mode for beans and collections back to the JVM wide default setting.


setVanilla

public static void setVanilla(boolean vanillaOn)
Set the mode for both Beans and Collections.


isVanillaBeans

public static boolean isVanillaBeans()
Return true if beans are serialized to Vanilla as opposed to byte code generated subclasses.


setVanillaBeans

public static void setVanillaBeans(boolean vanillaOn)
Set whether beans should be serialized to Vanilla as opposed to byte code generated subclasses.


isVanillaCollections

public static boolean isVanillaCollections()
Return true if collections are serialized to be plain Lists Sets or Maps as opposed to BeanList, BeanMap or BeanSet.


setVanillaCollections

public static void setVanillaCollections(boolean vanillaOn)
Set whether collections should be serialized to Vanilla Lists Sets or Maps (instead of BeanList, BeanMap or BeanSet).



Copyright © 2010. All Rights Reserved.