|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.andromda.translation.ocl.analysis.AnalysisAdapter
org.andromda.translation.ocl.analysis.DepthFirstAdapter
org.andromda.translation.ocl.BaseTranslator
org.andromda.translation.ocl.testsuite.TraceTranslator
public class TraceTranslator
This class allows us to trace the parsing of the expression. It is reflectively extended by Javassist to allow the inclusion of all "inA" and "outA" methods produced by the SableCC parser. This allows us to dynamically include all handling code in each method without having to manual code each one. It used used during development of Translators since it allows you to see the execution of each node.
| Constructor Summary | |
|---|---|
TraceTranslator()
Constructs an instance of TraceTranslator. |
|
| Method Summary | |
|---|---|
protected static void |
adaptClass()
This method is called by the main method during the build process, to "adapt" the class to the OCL parser. |
protected File |
getAdaptedClassOutputDirectory()
Retrieves the output directory which the adapted class will be written to. |
protected Class |
getAdaptedTranslationClass()
Creates and returns the adapted translator class. |
protected String |
getCaseMethodBody(CtMethod method)
Creates and returns the method body for each "caseA" method |
protected String |
getInAMethodBody(CtMethod method)
Creates and returns the method body for each "inA" method |
static Translator |
getInstance()
Creates and returns an new Instance of this ExpressionTranslator as a Translator object. |
protected String |
getMethodPrefix(CtMethod method)
Returns the prefix for the method (inA or outA) |
protected String |
getMethodTrace(CtMethod method)
Creates the debug statement that will be output for each method |
protected String |
getOclFragmentName(CtMethod method)
Returns the OCL fragment name that must have a matching name in the library translation template in order to be placed into the Expression translated expression buffer. |
protected String |
getOutAMethodBody(CtMethod method)
Creates and returns the method body for each "inA" method |
static void |
main(String[] args)
This main method is called during the build process, to "adapt" the class to the OCL parser. |
protected boolean |
needsAdaption()
Checks to see if this class needs to be adapted If it has the "adapted" field then we know it already has been adapted. |
void |
postProcess()
Ancestor abstract method which must be implemented even when it does nothing. |
Expression |
translate(String translationName,
String expression,
Object contextElement)
|
protected void |
writeAdaptedClass(CtClass pTranslatorClass)
Writes the class to the directory found by the class loader (since the class is a currently existing class) |
| Methods inherited from class org.andromda.translation.ocl.BaseTranslator |
|---|
getContextElement, getExpression, getOperation, getTranslationFragment, handleTranslationFragment, inAClassifierContextDeclaration, inADefClassifierExpressionBody, inAInvClassifierExpressionBody, inAOperationContextDeclaration, inAOperationExpressionBody, isOperationArgument, preProcess, process |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TraceTranslator()
| Method Detail |
|---|
public static Translator getInstance()
public Expression translate(String translationName,
String expression,
Object contextElement)
translate in interface Translatortranslate in class BaseTranslatorTranslator.translate(String, String, Object)protected boolean needsAdaption()
protected Class getAdaptedTranslationClass()
throws NotFoundException,
CannotCompileException,
IOException
NotFoundException
CannotCompileException
IOExceptionprotected void writeAdaptedClass(CtClass pTranslatorClass)
pTranslatorClass - protected File getAdaptedClassOutputDirectory()
protected String getCaseMethodBody(CtMethod method)
method -
case method bodyprotected String getInAMethodBody(CtMethod method)
method -
inA method bodyprotected String getOutAMethodBody(CtMethod method)
method -
outA method body.protected String getOclFragmentName(CtMethod method)
method -
protected String getMethodPrefix(CtMethod method)
method -
protected String getMethodTrace(CtMethod method)
method -
protected static void adaptClass()
public static void main(String[] args)
args - public void postProcess()
postProcess in class BaseTranslatorBaseTranslator.postProcess()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||