org.fuin.jmsmvc4swing.model
Class ControllerModel<T extends Controller>

java.lang.Object
  extended by org.fuin.jmsmvc4swing.model.ControllerModel<T>
Type Parameters:
T - A controller interface.

public final class ControllerModel<T extends Controller>
extends Object

Model for generating classes based on a Controller interface.


Constructor Summary
ControllerModel(Class<?> controllerInterface)
          Constructor with controller interface the generated classes are based on.
ControllerModel(String basePackage, Class<?> controllerInterface)
          Constructor with controller interface the generated classes are based on and the destination package for the generated classes.
ControllerModel(String basePackage, Class<?> controllerInterface, org.fuin.srcgen4javassist.ByteCodeGenerator generator)
          Constructor with controller interface, destination package for the generated classes and byte code generator.
 
Method Summary
 ControllerPair<T> createOnTheFly(JmsJndiEnvironment env, String topicName, Controller ctrl)
          Creates all classes "on-the-fly" with Javassist and then returns the necessary instances to work with.
 void createSource(File srcDir)
          Creates the source classes for the model.
 org.fuin.srcgen4javassist.SgClass getControllerInterface()
          Returns the controller interface the model is based on.
 org.fuin.srcgen4javassist.ByteCodeGenerator getGenerator()
          Returns the byte code generator the model uses.
 List<org.fuin.srcgen4javassist.SgClass> getModelClasses()
          Returns a list of the generated model classes.
 String getPackageName()
          Name of the interface converted into a package name.
 org.fuin.srcgen4javassist.SgClassPool getPool()
          Returns the class pool the model uses.
 String getSimpleName()
          Returns the name of the interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControllerModel

public ControllerModel(Class<?> controllerInterface)
Constructor with controller interface the generated classes are based on. The destination package for the generated classes is the same as the interface.

Parameters:
controllerInterface - Interface.

ControllerModel

public ControllerModel(String basePackage,
                       Class<?> controllerInterface)
Constructor with controller interface the generated classes are based on and the destination package for the generated classes.

Parameters:
basePackage - Package all generated classes are inside.
controllerInterface - Interface.

ControllerModel

public ControllerModel(String basePackage,
                       Class<?> controllerInterface,
                       org.fuin.srcgen4javassist.ByteCodeGenerator generator)
Constructor with controller interface, destination package for the generated classes and byte code generator.

Parameters:
basePackage - Package all generated classes are inside.
controllerInterface - Interface.
generator - Byte code generator - If NULL a default byte code generator instance will be created and used.
Method Detail

getModelClasses

public final List<org.fuin.srcgen4javassist.SgClass> getModelClasses()
Returns a list of the generated model classes.

Returns:
List of classes.

getControllerInterface

public final org.fuin.srcgen4javassist.SgClass getControllerInterface()
Returns the controller interface the model is based on.

Returns:
Controller interface.

getPackageName

public final String getPackageName()
Name of the interface converted into a package name. Inserts an underscore before every upper case character and returns an all lower case string. If the first character is upper case an underscore will not be inserted.

Returns:
Package for the generated classes.

getSimpleName

public final String getSimpleName()
Returns the name of the interface.

Returns:
Name without package.

createOnTheFly

public final ControllerPair<T> createOnTheFly(JmsJndiEnvironment env,
                                              String topicName,
                                              Controller ctrl)
Creates all classes "on-the-fly" with Javassist and then returns the necessary instances to work with. Alternatively you can use createSource(..) to generate source instead of bytecode

Parameters:
env - Environment to use for the instances.
topicName - Topic name to use.
ctrl - Real controller implementation doing the work.
Returns:
Two new created instances based on the "on-the-fly" created classes.

createSource

public void createSource(File srcDir)
                  throws IOException
Creates the source classes for the model. Alternatively you can use createOnTheFly(..) to generate bytecode instead of source.

Parameters:
srcDir - Destination directory.
Throws:
IOException - Error creating the classes.

getGenerator

public final org.fuin.srcgen4javassist.ByteCodeGenerator getGenerator()
Returns the byte code generator the model uses.

Returns:
Byte code generator.

getPool

public final org.fuin.srcgen4javassist.SgClassPool getPool()
Returns the class pool the model uses.

Returns:
Class pool.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.