Package org.apache.ws.jaxme.js.pattern

The pattern package

This package contains a set of design patterns implemented with the JaxMe JavaSource generator framework.

Interface Summary

ReflectorThe Reflector obtains informations on a certain class by converting it into an instance of JavaSource.
VersionGenerator.ColumnUpdaterThe ColumnUpdater is able to update one or more columns in a table.

Class Summary

AntA set of Ant tasks for running the generators in the pattern package.
Ant.AntChainGeneratorAnt task for the ChainGenerator.
Ant.AntProxyGeneratorThe AntProxyGenerator is an Ant task providing access to the ProxyGenerator.
Ant.AntTypesafeEnumerationGeneratorAnt task for generating typesafe enumerations.
Ant.AntVersionGeneratorAnt task for the VersionGenerator
Ant.BasicAntTask
Ant.ReallyBasicAntTask
Ant.XmlRpcGeneratorAn ant task for the XmlRpcClientGenerator.
Ant.XmlRpcGenerator.DispatcherThe nested child element "dispatcher".
ChainGeneratorThis class generates so-called event chains.
CompiledClassReflectorReflector for gathering information on a compiled class.
InterfaceDescriptionThe InterfaceDescription is used by the ProxyGenerator as information storage about the interfaces being implemented.
The main purporse of an intermediate class is to encapsulate the way, how information about these classes is gathered:
  1. If the interface being implemented is a compiled class, then Java reflection is used.
  2. Otherwise, if the interface being implemented is present as a Java source file, then the JavaParser is used.
MethodKeyThis class is a key for generated methods.
ProxyGeneratorThis class is a generator for the proxy object pattern.
SourceReflectorReflector for gathering information about a Java source file.
TypesafeEnumerationGeneratorThis class is a generator for the typesafe enumeration pattern.
TypesafeEnumerationGenerator.Item
VersionGeneratorThe VersionGenerator is able to clone a version of a row in a database.
VersionGenerator.TableInfoThis class is used internally to maintain the informations on the tables being cloned.

The pattern package

This package contains a set of design patterns implemented with the JaxMe JavaSource generator framework. It is provided both for demonstration and actual use. Each pattern is accompanied with a corresponding Ant task that allows to invoke the respective generator from within an Ant build script. The patterns are:

Design pattern(s)ClassAnt taskDescription
Proxy objects
Multiple inheritance
ProxyGeneratorproxyGeneratorProxy are instances that delegate most or all method calls to another object. Proxy objects in Java are typically created by the class java.lang.reflect.Proxy. Compared to this class, the generator has the advantage, that it is much easier to adapt the proxy object to your own needs: In our case you simple subclass the generated Proxy class.
Proxy objects can also be used to implement something like multiple inheritance. This is demonstrated in the Unit test MultipleInheritanceTest, where a subclass of java.util.Observable is created, that is also an instance of java.util.List by inheriting from java.util.ArrayList.
Typesafe enumerationsTypesafeEnumerationGeneratorenumGeneratorA typesafe enumeration is a Java class that guarantees that only a specified set of instances can exist. These instances are part of the class and accessible through public, static, final fields.
Proxy chainsChainGeneratorchainGeneratorA proxy chain can be viewed as a set of event handlers implementing a common interface. The interface methods are the events being processed. Each element in the chain can decide to process an event alone (by returning immediately), to delegate the event to the next element in the chain (by calling the interface method in its superclass) or to post process the result of the delegated event.