Skip to content

This is a small AST transformation that allows you to get the source code of a Class at run-time.

Notifications You must be signed in to change notification settings

MeneDev/groovy-get-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Groovy Get-Source

CircleCI

This is a small AST transformation that allows you to get the source code of a Class at run-time.

Example

@SaveSource
class AClass {

    def getCode() {
        SourceCode sourceCode = this.class.getAnnotation(SourceCode)
        return sourceCode.value()
    }
}

Usage

You can add a dependency to you build via jitpack.

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    compile 'com.github.MeneDev:groovy-get-source:96746d39f3'
}

Notes

This was created as an answer to the question Source code of current file in Groovy on Stackoverflow.

About

This is a small AST transformation that allows you to get the source code of a Class at run-time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages