or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

ast-transforms.mdcli.mdcore-language.mdindex.mdjson.mdsql.mdswing.mdtemplates.mdxml.md
tile.json

tessl/maven-org-codehaus-groovy--groovy-all

Apache Groovy - A powerful multi-faceted programming language for the JVM platform with comprehensive module support

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.codehaus.groovy/groovy-all@3.0.x

To install, run

npx @tessl/cli install tessl/maven-org-codehaus-groovy--groovy-all@3.0.0

index.mddocs/

Apache Groovy

Apache Groovy is a powerful, optionally typed and dynamic language with static-typing and static compilation capabilities for the Java platform. It aims to improve developer productivity thanks to a concise, familiar and easy to learn syntax. The groovy-all package provides the complete Groovy distribution including the core language and all optional modules.

Package Information

  • Package Name: groovy-all
  • Package Type: maven
  • Language: Groovy/Java
  • Installation: implementation 'org.codehaus.groovy:groovy-all:3.0.25'

Core Imports

import groovy.lang.*
import groovy.util.*

For Maven dependency:

<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>3.0.25</version>
</dependency>

For Gradle:

implementation 'org.codehaus.groovy:groovy-all:3.0.25'

Basic Usage

import groovy.lang.GroovyShell
import groovy.lang.Binding

// Create and execute Groovy scripts
def binding = new Binding()
binding.setVariable('name', 'World')
def shell = new GroovyShell(binding)
def result = shell.evaluate('println "Hello, $name!"; return "Done"')

// Use Groovy collections and closures
def numbers = [1, 2, 3, 4, 5]
def doubled = numbers.collect { it * 2 }
def evens = numbers.findAll { it % 2 == 0 }

// Work with dynamic objects
def expando = new groovy.lang.Expando()
expando.name = 'Groovy'
expando.version = '3.0.25'
expando.greet = { "Hello from ${name} ${version}!" }

Architecture

Apache Groovy is organized into several key layers:

  • Core Language: Dynamic typing, closures, metaprogramming capabilities (groovy.lang)
  • Runtime Extensions: Method extensions that add functionality to Java classes
  • Compilation System: Both dynamic and static compilation with AST transformations
  • Builder Pattern Support: Structured data and UI construction via builders
  • Integration Modules: Specialized modules for JSON, XML, SQL, templating, and more

Capabilities

Core Language Features

The fundamental Groovy language constructs including script execution, dynamic objects, closures, and metaprogramming facilities.

class GroovyShell {
    GroovyShell()
    GroovyShell(Binding binding)
    GroovyShell(ClassLoader parent, Binding binding)
    Object evaluate(String scriptText)
    Object evaluate(File scriptFile)
    Script parse(String scriptText)
}

class Binding {
    Binding()
    Binding(Map variables)
    Binding(String[] args)
    Object getVariable(String name)
    void setVariable(String name, Object value)
    boolean hasVariable(String name)
    void removeVariable(String name)
    Map getVariables()
    Object getProperty(String property)
    void setProperty(String property, Object newValue)
}

abstract class Closure<V> {
    Object call(Object... args)
    Closure<V> curry(Object... args) 
    Object getDelegate()
    void setDelegate(Object delegate)
}

Core Language

JSON Processing

JSON parsing, generation, and manipulation using JsonSlurper and JsonBuilder with configurable parsing strategies.

class JsonSlurper {
    JsonSlurper()
    Object parseText(String text)
    Object parse(File file)
    Object parse(URL url)
    JsonSlurper setType(JsonParserType type)
    int getMaxSizeForInMemory()
    JsonSlurper setMaxSizeForInMemory(int size)
}

class JsonBuilder {
    JsonBuilder()
    JsonBuilder(Object content)
    Object call(Closure c)
    String toString()
    String toPrettyString()
}

JSON Processing

XML Processing

XML parsing with GPath navigation, DOM manipulation, and markup generation using various XML processing approaches.

class XmlSlurper {
    XmlSlurper()
    XmlSlurper(boolean validating, boolean namespaceAware)
    GPathResult parseText(String text)
    GPathResult parse(File file)
    GPathResult parse(URL url)
}

class MarkupBuilder {
    MarkupBuilder(Writer writer)
    Object invokeMethod(String methodName, Object args)
    void yield(Object value, boolean escapeMarkup)
}

XML Processing

Database Access

SQL database operations, connection management, and result set processing with Groovy's SQL class and DataSet.

class Sql {
    static Sql newInstance(String url, String user, String password, String driverClassName)
    static Sql newInstance(DataSource dataSource)
    List<GroovyRowResult> rows(String sql, List<Object> params)
    void execute(String sql, List<Object> params)
    int executeUpdate(String sql, List<Object> params)
    void close()
}

class DataSet {
    DataSet(Sql sql, String table)
    void add(Map<String, Object> values)
    List<GroovyRowResult> findAll(Closure where)
    int update(Closure where, Map<String, Object> values)
}

Database Access

Template Processing

Template engines for generating dynamic content from templates with variable substitution and embedded code execution.

class SimpleTemplateEngine {
    SimpleTemplateEngine()
    Template createTemplate(String templateText)
    Template createTemplate(File templateFile)
}

interface Template {
    Writable make(Map<String, Object> binding)
}

class GStringTemplateEngine {
    GStringTemplateEngine()
    Template createTemplate(String templateText)
}

Template Processing

AST Transformations

Compile-time code generation and modification through annotations that transform the Abstract Syntax Tree.

@interface ToString {
    boolean includeNames() default false
    boolean includeFields() default false
    String[] excludes() default {}
    String[] includes() default {}
}

@interface CompileStatic {}

@interface TypeChecked {}

@interface Immutable {
    String[] excludes() default {}
    boolean copyWith() default false
}

AST Transformations

Command Line Interface

Command-line argument parsing and processing using PicoCLI integration for building CLI applications.

class CliBuilder {
    CliBuilder()
    CliBuilder(String usage)
    void setUsage(String usage) 
    OptionAccessor parse(String[] args)
    def opt(String opt, String longOpt, String description)
}

Command Line Interface

Swing UI Building

Swing user interface construction using builder pattern for creating desktop applications with Groovy.

class SwingBuilder {
    SwingBuilder()
    Object invokeMethod(String name, Object args)
    JFrame frame(Map<String, Object> attributes, Closure content)
    JPanel panel(Map<String, Object> attributes, Closure content)
}

Swing UI Building

Types

Core Types

interface GroovyObject {
    Object invokeMethod(String name, Object args)
    Object getProperty(String property)
    void setProperty(String property, Object newValue)
    MetaClass getMetaClass()
    void setMetaClass(MetaClass metaClass)
}

abstract class Script {
    abstract Object run()
    Object getProperty(String property)
    void setProperty(String property, Object newValue)
    Binding getBinding()
    void setBinding(Binding binding)
}

class Expando implements GroovyObject {
    Expando()
    Expando(Map<String, Object> properties)
}

abstract class GString implements Comparable, CharSequence, Writable {
    Object[] getValues()
    String[] getStrings()
    String toString()
}

Range Types

class IntRange implements Range<Integer> {
    IntRange(int from, int to)
    IntRange(boolean inclusive, int from, int to)
    boolean contains(Object value)
    List<Integer> step(int stepSize)
}

class ObjectRange implements Range<Comparable> {
    ObjectRange(Comparable from, Comparable to)
    ObjectRange(Comparable from, Comparable to, boolean inclusive)
}

Exception Types

class GroovyRuntimeException extends RuntimeException {
    GroovyRuntimeException(String message)
    GroovyRuntimeException(String message, Throwable cause)
}

class MissingMethodException extends GroovyRuntimeException {
    MissingMethodException(String method, Class type, Object[] arguments)
    String getMethod()
    Class getType()
}

class MissingPropertyException extends GroovyRuntimeException {
    MissingPropertyException(String property, Class type)
    String getProperty()
    Class getType()
}