com.mchange.v2.codegen.bean
Class SerializableExtension

java.lang.Object
  extended by com.mchange.v2.codegen.bean.SerializableExtension
All Implemented Interfaces:
GeneratorExtension
Direct Known Subclasses:
IndirectingSerializableExtension

public class SerializableExtension
extends Object
implements GeneratorExtension

Note: this class pays no attention to whether users have marked any property variables as transient. In fact, it will work most efficiently if users mark ALL variables as transient... to define transient properties for this class, use the constructor which allows a user-specified set of transients.


Constructor Summary
SerializableExtension()
           
SerializableExtension(Set transientProperties, Map transientPropertyInitializers)
           
 
Method Summary
 Collection extraGeneralImports()
           
 Collection extraInterfaceNames()
           
 Collection extraSpecificImports()
           
 void generate(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw)
           
protected  void generateExtraSerInitializers(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw)
           
protected  void generateExtraSerWriteStatements(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw)
           
protected  void writeStoreObject(Property prop, Class propType, IndentedWriter iw)
           
protected  void writeUnstoreObject(Property prop, Class propType, IndentedWriter iw)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializableExtension

public SerializableExtension(Set transientProperties,
                             Map transientPropertyInitializers)
Parameters:
transientProperties - a set of Strings, the names of all properties that should be considered transient and not serialized
transientPropertyInitializers - an optional Map of a subset of the transient property names to non-default initialization expressions, which should be unterminated expressions, and which will be used verbatim in the generated code.

SerializableExtension

public SerializableExtension()
Method Detail

extraGeneralImports

public Collection extraGeneralImports()
Specified by:
extraGeneralImports in interface GeneratorExtension

extraSpecificImports

public Collection extraSpecificImports()
Specified by:
extraSpecificImports in interface GeneratorExtension

extraInterfaceNames

public Collection extraInterfaceNames()
Specified by:
extraInterfaceNames in interface GeneratorExtension

generate

public void generate(ClassInfo info,
                     Class superclassType,
                     Property[] props,
                     Class[] propTypes,
                     IndentedWriter iw)
              throws IOException
Specified by:
generate in interface GeneratorExtension
Throws:
IOException

writeStoreObject

protected void writeStoreObject(Property prop,
                                Class propType,
                                IndentedWriter iw)
                         throws IOException
Throws:
IOException

writeUnstoreObject

protected void writeUnstoreObject(Property prop,
                                  Class propType,
                                  IndentedWriter iw)
                           throws IOException
Throws:
IOException

generateExtraSerWriteStatements

protected void generateExtraSerWriteStatements(ClassInfo info,
                                               Class superclassType,
                                               Property[] props,
                                               Class[] propTypes,
                                               IndentedWriter iw)
                                        throws IOException
Throws:
IOException

generateExtraSerInitializers

protected void generateExtraSerInitializers(ClassInfo info,
                                            Class superclassType,
                                            Property[] props,
                                            Class[] propTypes,
                                            IndentedWriter iw)
                                     throws IOException
Throws:
IOException