home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (AnnotationClosureUnqualifiedCallTest.groovy)

This example Groovy source code file (AnnotationClosureUnqualifiedCallTest.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

annotationclosureexhaustivetestsupport, annotationclosureexhaustivetestsupport, annotationclosureunqualifiedcalltest, annwithclasselement, annwithclasselement, class, class, unqualifiedcall, unqualifiedcall

The Groovy AnnotationClosureUnqualifiedCallTest.groovy source code

package gls.annotations.closures

class AnnotationClosureUnqualifiedCallTest extends AnnotationClosureExhaustiveTestSupport {
    Class getAnnotationClass() { AnnWithClassElement }

    Class getAnnotatedClass() { UnqualifiedCall }

    void verify(Class closureClass) {
        def closure = closureClass.newInstance(this, this)
        assert closure.call() == 42
    }

    def answer() { 42 }
}

@AnnWithClassElement(elem = { answer() })
class UnqualifiedCall {
    @AnnWithClassElement(elem = { answer() })
    private aField

    @AnnWithClassElement(elem = { answer() })
    def aProperty

    @AnnWithClassElement(elem = { answer() })
    def aMethod(@AnnWithClassElement(elem = { answer() }) aParam) {
        @AnnWithClassElement(elem = { answer() })
        def aLocal
    }
}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy AnnotationClosureUnqualifiedCallTest.groovy source code file:

new blog posts

 

Copyright 1998-2014 Alvin Alexander, alvinalexander.com
All Rights Reserved.