Search in sources :

Example 1 with LineNumber

use of ratpack.groovy.script.internal.LineNumber in project ratpack by ratpack.

the class ClosureUtil method getSourceInfo.

public static SourceInfo getSourceInfo(Closure<?> closure) {
    Class<?> closureClass = closure.getClass();
    LineNumber lineNumber = closureClass.getAnnotation(LineNumber.class);
    if (lineNumber == null) {
        return null;
    }
    Class<?> rootClass = getRootClass(closure);
    ScriptPath scriptPath = rootClass.getAnnotation(ScriptPath.class);
    if (scriptPath == null) {
        return null;
    }
    return new SourceInfo(scriptPath.value(), lineNumber.value());
}
Also used : ScriptPath(ratpack.groovy.script.internal.ScriptPath) LineNumber(ratpack.groovy.script.internal.LineNumber)

Aggregations

LineNumber (ratpack.groovy.script.internal.LineNumber)1 ScriptPath (ratpack.groovy.script.internal.ScriptPath)1