net.sourceforge.jenesis4java.example
Class SimpleGenerator

java.lang.Object
  extended by net.sourceforge.jenesis4java.example.SimpleGenerator

public class SimpleGenerator
extends Object

The SimpleGenerator class creates getXXX(), setXXX(), and member fields using the addMember() method.


Constructor Summary
SimpleGenerator()
          Create a new SimpleGenerator.
 
Method Summary
 void addMember(Type type, String name)
          Intermediate steps: Add a member to the class such that a member field, getter method, and setter method are defined for the member having the given name and type.
 void generate()
          Final step: Generate the class.
 void initialize(String codebase, String packageName, String className)
          Step 1: Internally setup the CompilationUnit and PackageClass to be generated using the given codebase, packageName, and className.
static void main(String[] argv)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleGenerator

public SimpleGenerator()
Create a new SimpleGenerator.

Method Detail

main

public static void main(String[] argv)
                 throws Exception
Throws:
Exception

addMember

public void addMember(Type type,
                      String name)
Intermediate steps: Add a member to the class such that a member field, getter method, and setter method are defined for the member having the given name and type.


generate

public void generate()
              throws Exception
Final step: Generate the class. This calls CompilationUnit.encode()

Throws:
Exception

initialize

public void initialize(String codebase,
                       String packageName,
                       String className)
                throws Exception
Step 1: Internally setup the CompilationUnit and PackageClass to be generated using the given codebase, packageName, and className.

Parameters:
codebase - - where the generated class should be written (for example /tmp).
packageName - - the name of the package for the generated class (for example com.example.util).
className - - the name of the generated class.
Throws:
Exception


Copyright © 2014. All Rights Reserved.