org.apache.ws.jaxme.js.pattern

Class ChainGenerator

public class ChainGenerator extends Object

This class generates so-called event chains. A chain is an interface and an object implementing the interface. Internally the implementation is using a list of chained objects, which you can assume to implement the same interface.

Any event is passed to the first object in the list. The object may decide to resolve the event immediately and return. It may also call pass the event to the next object, take the returned value, possibly modify it and return the result. Finally, the chained object may decide to emit another event (which is passed along the same chain), and use the returned value.

Author: Jochen Wiedmann

Method Summary
voidfinish()
Validates the input data.
JavaSource[]generate(JavaSourceFactory pFactory)
Performs the actual work by generating classes using the given pFactory.
JavaQNamegetChainInterface()

Returns the interface being generated for the chain objects.

JavaSourcegetControllerInterface()
Returns the controller interface.
JavaQNamegetImplementationClass()

Returns the chain implementation classes name.

JavaQNamegetProxyClass()

Returns the class being generated for the chain objects.

protected JavaSource[]initControllerInterface()

Initializes the controller interface.

static voidmain(String[] args)
voidsetChainInterface(JavaQName pInterface)

Sets the interface being generated for the chain objects.

voidsetChainInterfaceName(String pInterfaceName)

Sets the interface name being generated for the chain objects.

voidsetControllerInterfaceName(String pInterfaceName)

Sets the controller interface name.

voidsetImplementationClass(JavaQName pClassName)

Sets the chain implementation class.

voidsetImplementationClassName(String pClassName)

Sets the name of the chain implementation class.

voidsetProxyClass(JavaQName pClassName)

Sets the class being generated for the chain objects.

voidsetProxyClassName(String pClassName)

Sets the class name being generated for the chain objects.

Method Detail

finish

public void finish()
Validates the input data.

generate

public JavaSource[] generate(JavaSourceFactory pFactory)
Performs the actual work by generating classes using the given pFactory.

getChainInterface

public JavaQName getChainInterface()

Returns the interface being generated for the chain objects.

getControllerInterface

public JavaSource getControllerInterface()
Returns the controller interface.

getImplementationClass

public JavaQName getImplementationClass()

Returns the chain implementation classes name. Defaults to getControllerInterface() + "Impl".

getProxyClass

public JavaQName getProxyClass()

Returns the class being generated for the chain objects. Defaults to getChainInterface() + "Impl".

initControllerInterface

protected JavaSource[] initControllerInterface()

Initializes the controller interface.

Throws: ClassNotFoundException IOException TokenStreamException RecognitionException

main

public static void main(String[] args)

setChainInterface

public void setChainInterface(JavaQName pInterface)

Sets the interface being generated for the chain objects.

setChainInterfaceName

public void setChainInterfaceName(String pInterfaceName)

Sets the interface name being generated for the chain objects.

setControllerInterfaceName

public void setControllerInterfaceName(String pInterfaceName)

Sets the controller interface name.

setImplementationClass

public void setImplementationClass(JavaQName pClassName)

Sets the chain implementation class.

setImplementationClassName

public void setImplementationClassName(String pClassName)

Sets the name of the chain implementation class.

setProxyClass

public void setProxyClass(JavaQName pClassName)

Sets the class being generated for the chain objects.

setProxyClassName

public void setProxyClassName(String pClassName)

Sets the class name being generated for the chain objects.