「APACHE-GROOVY」- 场景 | 方案

01)变量参数:用于存储数据的容器;

02)数据类型:描述变量可以存储的数据的种类,如整数、浮点数、布尔值等;

03)运算符号:用于对变量进行操作的符号,如加减乘除等;

04)控制结构:用于控制程序如何执行的结构,如条件语句、循环语句等;

三元运算

def displayName = (name != null) ? name : "匿名用户"
def displayName = name ?: "匿名用户"

05)函数方法:一段可重复使用的代码,用于完成特定的任务;

06)类和对象:面向对象编程中的基本概念,用于描述现实世界中的事物;

07)模块单元:用于组织代码的单元,可以将代码分成多个文件或模块,提高代码的可维护性和重用性;

08)注释注解:用于在代码中添加说明性文字,方便其他人理解代码;

09)异常处理:用于处理程序中可能出现的错误或异常情况;

10)编译解释:编程语言的执行方式,编译将源代码转换为可执行文件,解释直接解释执行源代码;

11)标准类库:编程语言提供的标准函数和类库,用于完成常见的任务;

  • 依赖管理工具 —— Grape

with Maven

Building a Groovy project with Maven – redcube.de

indy | Invoke Dynamic

Difference between groovy-all-*.jar and groovy-all-*-indy.jar – Stack Overflow

Since Groovy 2.0, we added support for the JVM invokedynamic instruction. This instruction is supported since Java 7 and is a new bytecode instruction in the JVM that allows easier implementation of dynamic languages. This instruction will also be used internally, by the JVM, for the upcoming lamdba support in Java 8.

This means that unlike APIs, AST transformations or syntactic sugar, this feature is not visible to the developer or the end user. It is a compilation and runtime feature only