Polish formatting in Groovy scripts
This commit is contained in:
@@ -5,6 +5,7 @@ import org.springframework.scripting.Calculator
|
||||
class GroovyCalculator implements Calculator {
|
||||
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
return x + y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,14 +11,15 @@ class GroovyCallCounter implements CallCounter {
|
||||
}
|
||||
|
||||
void before() {
|
||||
count++;
|
||||
count++;
|
||||
}
|
||||
|
||||
int getCalls() {
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
count = -200;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,17 +3,18 @@ package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Calculator
|
||||
|
||||
class DelegatingCalculator implements Calculator {
|
||||
|
||||
|
||||
def Calculator delegate;
|
||||
|
||||
int add(int x, int y) {
|
||||
//println "hello"
|
||||
//println this.metaClass.getClass()
|
||||
//println delegate.metaClass.getClass()
|
||||
//delegate.metaClass.invokeMethod("add", [x,y])
|
||||
|
||||
delegate.callMissingMethod()
|
||||
|
||||
return delegate.add(x,y)
|
||||
//println "hello"
|
||||
//println this.metaClass.getClass()
|
||||
//println delegate.metaClass.getClass()
|
||||
//delegate.metaClass.invokeMethod("add", [x,y])
|
||||
|
||||
delegate.callMissingMethod()
|
||||
|
||||
return delegate.add(x,y)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user