org.apache.tapestry.test
Class Creator

java.lang.Object
  extended by org.apache.tapestry.test.Creator

public class Creator
extends Object

A utility class that is used to instantiate abstract Tapestry pages and components. It creates, at runtime, a subclass where all abstract properties are filled in (each property complete with an instance variable, an accessor method and a mutator method). This isn't quite the same as how the class is enhanced at runtime (though it does use a subset of the same code), but is sufficient to unit test the class, especially listener methods.

One part of the enhancement is that the specification and messages properties of the page or component class are converted into read/write properties that can be set via reflection (including newInstance(Class, Map).

Since:
4.0
Author:
Howard Lewis Ship

Constructor Summary
Creator()
           
 
Method Summary
 Object newInstance(Class abstractClass)
          Given a particular abstract class; will create an instance of that class.
 Object newInstance(Class abstractClass, Map properties)
          Creates a new instance of a given class, and then initializes properties of the instance.
 Object newInstance(Class abstractClass, Object[] properties)
          A convienience (useful in test code) for invoking newInstance(Class, Map).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Creator

public Creator()
Method Detail

newInstance

public Object newInstance(Class abstractClass)
Given a particular abstract class; will create an instance of that class. A subclass is created with all abstract properties filled in with ordinary implementations.


newInstance

public Object newInstance(Class abstractClass,
                          Map properties)
Creates a new instance of a given class, and then initializes properties of the instance. The map contains string keys that are property names, and object values.


newInstance

public Object newInstance(Class abstractClass,
                          Object[] properties)
A convienience (useful in test code) for invoking newInstance(Class, Map). The Map is constructed from the properties array, which consists of alternating keys and values.



Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.