All Downloads are FREE. Search and download functionalities are using the official Maven repository.

groovy.0-base.groovy Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
__QUERY_NAME__="core"

scriptImportClass = {c -> __groovySession.addScriptImportClass(c)}
scriptImportStatic = {c -> __groovySession.addScriptImportStatic(c)}

isValidVariableName = {name -> name.matches("^[a-zA-Z_][a-zA-Z_0-9]*")}

publishVariable = { String name, value ->
    if(!isValidVariableName(name)){
        throw new RuntimeException("publishVariable: Attempting to publish an invalid variable name: " + name)
    }

    binding.setVariable(name, value)
}

removeVariable = {name ->
    if(!isValidVariableName(name)){
        throw new RuntimeException("removeVariable: Attempting to remove an invalid variable name: " + name)
    }

    binding.variables.remove(name)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy