|
Groovy example source code file (AnnotationClosureThisObjectCallTest.groovy)
The Groovy AnnotationClosureThisObjectCallTest.groovy source code
package gls.annotations.closures
class AnnotationClosureThisObjectCallTest extends AnnotationClosureExhaustiveTestSupport {
Class getAnnotationClass() { AnnWithClassElement }
Class getAnnotatedClass() { CallOnThisObject }
void verify(Class closureClass) {
def closure = closureClass.newInstance(null, this)
assert closure.call() == 42
}
def answer() { 42 }
}
@AnnWithClassElement(elem = { this.answer() })
class CallOnThisObject {
@AnnWithClassElement(elem = { this.answer() })
private aField
@AnnWithClassElement(elem = { this.answer() })
def aProperty
@AnnWithClassElement(elem = { this.answer() })
def aMethod(@AnnWithClassElement(elem = { this.answer() }) aParam) {
@AnnWithClassElement(elem = { this.answer() })
def aLocal
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy AnnotationClosureThisObjectCallTest.groovy source code file: |
Other websites by Alvin Alexander:
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)
Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.