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