|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ca.quine.jcommons.sourceexporter.ChainOfResponsibility
Implements a Chain of Responsibility along the lines of the pattern described in "Design Patterns", Gamma et. al., and provides helper methods to use the chain to export (or "marshal") objects as source code. Each marshaller in the chain gets a chance at marshalling the object, and the first one (in order) that indicates that it can handle the marshalling will be called to marshal it.
This class is called by SourceExporter
to do the actual work of marshalling the object.
Constructor Summary | |
ChainOfResponsibility()
|
Method Summary | |
void |
addMarshaller(SourceMarshaller sourceMarshaller)
|
String |
marshal(MarshallingContext context,
ClassSource classSource,
Object object,
boolean marshalAsObject)
Tests each marshaller in the ChainOfResponsibility to see if it
can marshal the given object , and passes on the request
to marshal it to that marshaller. |
boolean |
marshal(String filename,
String packageName,
String testClassName,
String className,
String methodName,
Object object)
Creates a new marshalling context and passes all parameters on to marshal(String, String, String, String, String, Object, MarshallingContext) . |
boolean |
marshal(String filename,
String packageName,
String testClassName,
String className,
String methodName,
Object object,
MarshallingContext context)
Tests each marshaller in the ChainOfResponsibility to see if it
can marshal the given object , and passes on the request
to marshal it to that marshaller. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ChainOfResponsibility()
Method Detail |
public void addMarshaller(SourceMarshaller sourceMarshaller)
public boolean marshal(String filename, String packageName, String testClassName, String className, String methodName, Object object) throws IOException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException
marshal(String, String, String, String, String, Object, MarshallingContext)
.
filename
- packageName
- testClassName
- className
- methodName
- object
-
IOException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
ClassNotFoundException
InstantiationException
public boolean marshal(String filename, String packageName, String testClassName, String className, String methodName, Object object, MarshallingContext context) throws IOException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException
ChainOfResponsibility
to see if it
can marshal the given object
, and passes on the request
to marshal it to that marshaller. This method will be called by
code outside of the SourceExporter in order to start the export at the
"top" or "outer" class.
filename
- packageName
- testClassName
- className
- methodName
- object
- context
- holds any state required by the marshallers
(so that the marshallers can be reused in a
threaded environment)
DefaultMarshaller
has been removed
from the chain)
IOException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
ClassNotFoundException
InstantiationException
public String marshal(MarshallingContext context, ClassSource classSource, Object object, boolean marshalAsObject) throws IOException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException
ChainOfResponsibility
to see if it
can marshal the given object
, and passes on the request
to marshal it to that marshaller. This method will be called by
code inside the SourceExporter to marshal classes referenced by the
"top" or "outer" class where marshalling began.
context
- classSource
- object
- marshalAsObject
-
IOException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
ClassNotFoundException
InstantiationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |