Commit 0c188274 authored by seinturi's avatar seinturi

Refactor API of InterceptorClass and InterceptorSourceCode generators.

parent 225d3ad2
...@@ -117,7 +117,7 @@ extends AbstractProxyClassGenerator { ...@@ -117,7 +117,7 @@ extends AbstractProxyClassGenerator {
} }
@Override @Override
public void generateProxyMethodBodyBeforeCode( public void generateProxyMethodBody(
BlockSourceCodeVisitor mv, Method proxym ) { BlockSourceCodeVisitor mv, Method proxym ) {
/* /*
...@@ -132,11 +132,12 @@ extends AbstractProxyClassGenerator { ...@@ -132,11 +132,12 @@ extends AbstractProxyClassGenerator {
// Begin of the try block // Begin of the try block
mv.visitln(" try {"); mv.visitln(" try {");
}
@Override // Call to the delegate
public void generateProxyMethodBodyAfterCode( generateProxyMethodBodyDelegatingCode(mv,proxym);
BlockSourceCodeVisitor mv, Method proxym ) {
// Return the result
generateProxyMethodBodyReturn(mv,proxym);
// End of the try block // End of the try block
mv.visitln(" }"); mv.visitln(" }");
......
...@@ -117,7 +117,7 @@ extends AbstractInterceptorSourceCodeGenerator { ...@@ -117,7 +117,7 @@ extends AbstractInterceptorSourceCodeGenerator {
} }
@Override @Override
public void generateProxyMethodBodyFinallyCode( public void generateProxyMethodBodyAfterReturningCode(
BlockSourceCodeVisitor mv, Method proxym ) { BlockSourceCodeVisitor mv, Method proxym ) {
// End of the try block // End of the try block
......
...@@ -382,7 +382,7 @@ extends AbstractInterceptorSourceCodeGenerator { ...@@ -382,7 +382,7 @@ extends AbstractInterceptorSourceCodeGenerator {
} }
@Override @Override
public void generateProxyMethodBodyFinallyCode( public void generateProxyMethodBodyAfterReturningCode(
BlockSourceCodeVisitor mv, Method proxym ) { BlockSourceCodeVisitor mv, Method proxym ) {
// End of else block // End of else block
......
...@@ -181,12 +181,14 @@ extends AbstractProxyClassGenerator { ...@@ -181,12 +181,14 @@ extends AbstractProxyClassGenerator {
mv.visitEnd(); mv.visitEnd();
} }
private Conversational conversationalItf;
private Annotation oneWayMeth;
private Class<?> callbackClass;
@Override @Override
public void generateProxyMethodBodyBeforeCode( public void generateProxyMethodBody(
BlockSourceCodeVisitor mv, Method proxym ) { BlockSourceCodeVisitor mv, Method proxym ) {
super.generateProxyMethodBodyBeforeCode(mv,proxym);
conversationalItf = proxycl.getAnnotation(Conversational.class); conversationalItf = proxycl.getAnnotation(Conversational.class);
oneWayMeth = oneWayMeth =
AnnotatedElementHelper.getAnnotation( AnnotatedElementHelper.getAnnotation(
...@@ -254,16 +256,9 @@ extends AbstractProxyClassGenerator { ...@@ -254,16 +256,9 @@ extends AbstractProxyClassGenerator {
mv.visitln(" _setCallback(cb);"); mv.visitln(" _setCallback(cb);");
mv.visitln(" _pushCallback(cb);"); mv.visitln(" _pushCallback(cb);");
} }
}
private Conversational conversationalItf;
private Annotation oneWayMeth;
private Class<?> callbackClass;
@Override
public void generateProxyMethodBodyAfterCode(
BlockSourceCodeVisitor mv, Method proxym ) {
super.generateProxyMethodBodyAfterCode(mv,proxym); // Call to the delegate
generateProxyMethodBodyDelegatingCode(mv,proxym);
EndsConversation end = proxym.getAnnotation(EndsConversation.class); EndsConversation end = proxym.getAnnotation(EndsConversation.class);
if( end != null ) { if( end != null ) {
...@@ -285,6 +280,10 @@ extends AbstractProxyClassGenerator { ...@@ -285,6 +280,10 @@ extends AbstractProxyClassGenerator {
if( callbackClass != Void.class ) { if( callbackClass != Void.class ) {
mv.visitln(" _popCallback();"); mv.visitln(" _popCallback();");
} }
// Return the result
generateProxyMethodBodyReturn(mv,proxym);
if( oneWayMeth != null ) { if( oneWayMeth != null ) {
mv.visitln(" }"); mv.visitln(" }");
mv.visitln(" }.start();"); mv.visitln(" }.start();");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment