没有合适的资源?快使用搜索试试~ 我知道了~
groovy 1.7官方教程。groovy is a super version of Java
资源详情
资源评论
资源推荐
Groovy Documentation
Groovy Introduction
Getting Started Guide
User Guide
Advanced Usage
Guide
Cookbook Examples
Testing Guide
Developer Guide
Modules
FAQ
Introduction to Groovy
Groovy Introduction
Groovy...
• is an agile and dynamic language for the Java Virtual Machine
• builds upon the strengths of Java but has additional power
features inspired by languages like Python, Ruby and Smalltalk
• makes modern programming features available to Java
developers with almost-zero learning curve
• supports Domain-Specific Languages and other compact
syntax so your code becomes easy to read and maintain
• makes writing shell and build scripts easy with its powerful
processing primitives, OO abilities and an Ant DSL
• increases developer productivity by reducing scaffolding
code when developing web, GUI, database or console applications
• simplifies testing by supporting unit testing and mocking out-of-the-box
• seamlessly integrates with all existing Java objects and libraries
• compiles straight to Java bytecode so you can use it anywhere you can use Java
Samples
A simple hello world script:
def name='World'; println "Hello $name!"
A more sophisticated version using Object Orientation:
class Greet {
def name
Greet(who) { name = who[0].toUpperCase() +
who[1..-1] }
def salute() { println "Hello $name!" }
}
g = new Greet('world') // create object
g.salute() // Output "Hello World!"
Leveraging existing Java libraries:
import static org.apache.commons.lang.WordUtils.*
class Greeter extends Greet {
Greeter(who) { name = capitalize(who) }
}
new Greeter('world').salute()
On the command line:
groovy -e "println 'Hello ' + args[0]" World
Ø·-¬±®§
Ò»© º»¿¬«®»- ¿²¼ ·³°®±ª»³»²¬- ·² Ù®±±ª§ ïòéæ
ß²±²§³±«- ײ²»® Ý´¿--»- ¿²¼ Ò»-¬»¼ ͬ¿¬·½ Ý´¿--»-
ß²²±¬¿¬·±² »²¸¿²½»³»²¬-
Ù®¿°» »²¸¿²½»³»²¬-
б©»® ß--»®¬-
ßÍÌ »²¸¿²½»³»²¬-æ ßÍÌ Ê·»©»® ¿²¼ ßÍÌ Þ«·´¼»®
ß¾·´·¬§ ¬± ½«-¬±³·¦» ¬¸» Ù®±±ª§ Ì®«¬¸
Ü»°»²¼»²½§ «°¹®¿¼»-
λ©®·¬» ±º Ù®±±ª§Í½®·°¬Û²¹·²»
Ù®±±ª§Ý±²-±´» »²¸¿²½»³»²¬-
ÍÏÔ ¾¿¬½¸ «°¼¿¬»- ¿²¼ ¬®¿²-¿½¬·±²-
Ó±®» ¼»¬¿·´-æ Ù®±±ª§ ïòé ®»´»¿-» ²±¬»-
Ò»© º»¿¬«®»- ¿²¼ ·³°®±ª»³»²¬- ·² Ù®±±ª§ ïòêæ
Ù®»¿¬ ®«²¬·³» °»®º±®³¿²½» ·³°®±ª»³»²¬-
Ó«´¬·°´» ¿--·¹²³»²¬-ó ±°¬·±²¿´ ®»¬«®² ·² ·ºñ»´-» ¿²¼ ¬®§ñ½¿¬½¸ ¾´±½µ-
ßÍÌ ¬®¿²-º±®³¿¬·±²- ¿²¼ ¿´´ ¬¸» °®±ª·¼»¼ ¬®¿²-º±®³¿¬·±² ¿²²±¬¿¬·±²- ´·µ» àÍ·²¹´»¬±²ô àÔ¿¦§ô à׳³«¬¿¾´»ô àÜ»´»¹¿¬» ¿²¼ º®·»²¼-
̸» Ù®¿°» ³±¼«´» ¿²¼ ¼»°»²¼»²½§ -§-¬»³ ¿²¼ ·¬- àÙ®¿¾ ¬®¿²-º±®³¿¬·±²
Ê¿®·±«- Í©·²¹ ¾«·´¼»® ·³°®±ª»³»²¬-ô ¬¸¿²µ- ¬± ¬¸» Í©·²¹ ñ Ù®·ºº±² ø ÷ ¬»¿³¸¬¬°æññ¹®·ºº±²ò½±¼»¸¿«-ò±®¹
ß- ©»´´ ¿- -»ª»®¿´ Í©·²¹ ½±²-±´» ·³°®±ª»³»²¬-
̸» ·²¬»¹®¿¬·±² ±º ÖÓÈ ¾«·´¼»®
ÖÍÎóîîí -½®·°¬·²¹ »²¹·²» ¾«·´¬ó·²
Ê¿®·±«- ³»¬¿°®±¹®¿³³·²¹ ·³°®±ª»³»²¬-ô ´·µ» ¬¸» ÛÓÝ ÜÍÔô °»®ó·²-¬¿²½» ³»¬¿½´¿--»- »ª»² º±® ÐÑÖÑ-ô ¿²¼ ®«²¬·³» ³·¨·²-
Ó±®» ¼»¬¿·´-æ ײº±¯
Ò»© º»¿¬«®»- ¿²¼ ·³°®±ª»³»²¬- ·² Ù®±±ª§ ïòëæ
ײ¬»¹®¿¬»- Ö¿ª¿ ë º»¿¬«®»-æ ¿²²±¬¿¬·±²-ô ¹»²»®·½-ô -¬¿¬·½ ·³°±®¬- ¿²¼ »²«³-
Ò»© ³»¬¿ó°®±¹®¿³³·²¹ ½¿°¿¾·´·¬·»-
ß º»© -§²¬¿¨ »²¸¿²½»³»²¬- ¸¿ª» ¿´-± º±«²¼ ¬¸»·® ©¿§ ·²¬± ·¬ ¬± ¸»´° »¿-» ¬¸» ¼»ª»´±°³»²¬ ±º ܱ³¿·²óÍ°»½·º·½ Ô¿²¹«¿¹»-
Ù®±±ª§ù- Í©·²¹ ¾«·´¼»® -«°°±®¬ô ¬± ¸»´° §±« ¾«·´¼ Í©·²¹ Ë×-ô ¸¿- ¿´³±-¬ ½±³°´»¬»´§ ¾»»² ®»©®·¬¬»² ¿²¼ -°·½»¼ «° ©·¬¸ -»ª»®¿´ «-»º«´
¿¼¼·¬·±²-
ß ¹®»¿¬ ¿¬¬»²¬·±² ¬± °»®º±®³¿²½» ·³°®±ª»³»²¬- ³¿¼» ¬¸·- ²»© ª»®-·±² ³«½¸
ß ¶±·²¬ Ö¿ª¿ ñ Ù®±±ª§ ½±³°·´»® ¬± ´»¬ §±« ³·¨ ¿²¼ ³¿¬½¸ Ù®±±ª§ ¿²¼ Ö¿ª¿ ½´¿--»- ·² ¬¸» -¿³» ½±³°·´¿¬·±² -¬»°
ß Ù®±±ª§Ü±½ »¯«·ª¿´»²¬ ¬± Ö¿ª¿Ü±½ ´»¬- §±« ¼±½«³»²¬ §±«® Ù®±±ª§ ½´¿--»-
ß ®»©®·¬¬»² ·²¬»®¿½¬·ª» -¸»´´ ·- ²±© ®»¿´´§ ·²¬»®¿½¬·ª» ¿²¼ °®±ª·¼»- «-»º«´ ½±³³¿²¼ ½±³°´»¬·±²- º±® ³¿µ·²¹ §±« ³±®» °®±¼«½¬·ª»
̸» Ù®±±ª§ Í©·²¹ ½±²-±´» ¸¿- ¿´-± ¾»»² ·³°®±ª»¼
Ó±®» ¼»¬¿·´-æ ײº±¯
Ù®±±ª§ ïòé ®»´»¿-» ²±¬»-
ݱª»®¿¹» ±º ¬¸»-» ²±¬»-
̸» ¾»´±© ®»´»¿-» ²±¬»- ½«®®»²¬´§ ½±ª»® ¬¸» ²»© º»¿¬«®»- ±º Ù®±±ª§ ïòéô ±«® ´¿¬»-¬ ³¿¶±® ®»´»¿-»ò
×ÜÛ Í«°°±®¬
Þ»º±®» ¼·ª·²¹ ¼·®»½¬´§ ·²¬± ¬¸» ²»© º»¿¬«®»- ·² Ù®±±ª§ ïòéô °´»¿-» ´»¬ ³» ³»²¬·±² ¬¸» ¹®»¿¬ °®±¹®»-- ³¿¼» ·² ¬»®³- ±º ×ÜÛ -«°°±®¬ º±® Ù®±±ª§ ø¿²¼
¿´-± º±® ô ô ±® ÷ò ß´´ ¬¸» ³¿¶±® ×ÜÛ- øÛ½´·°-»ô ô ÷ °®±ª·¼» ¿² »¨½»´´»²¬ ´»ª»´ ±º -«°°±®¬ º±® ¬¸»Ù®·ºº±²Ù®¿¼´»Ù¿²¬Ù®¿·´- ײ¬»´´·Ö ×ÜÛßÒ»¬Þ»¿²-
´¿²¹«¿¹»ò ײ·¬·¿´´§ô ¬¸» Û½´·°-» -«°°±®¬ ©¿- ¬¸» ±²» ´¿½µ·²¹ ¬¸» ³±-¬ô ¾«¬ ¬¸¿²µ- ¬± ¬¸» ¸¿®¼ ©±®µ ±º ¬¸» Í°®·²¹Í±«®½» Û½´·°-» ¬»¿³ô ©» ²±© ¸¿ª»
¿ ¹®»¿¬ »²ª·®±²³»²¬ º±® ¼»ª»´±°·²¹ ³·¨»¼ Ö¿ª¿ ñ Ù®±±ª§ ¿°°´·½¿¬·±²- ©·¬¸ º»¿¬«®»- ´·µ» ½®±--ó´¿²¹«¿¹» ®»º¿½¬±®·²¹ô Ù®±±ª§ó-°»½·º·½ ½±¼»
½±³°´»¬·±²ô ¿²¼ ³±®»ò
Ò»© ¿²¼ ׳°®±ª»¼ Û½´·°-» °´«¹·²
Ú±® ³±®» ·²º±®³¿¬·±² ±² ¬¸» Û½´·°-» -«°°±®¬ô °´»¿-» ¸¿ª» ¿ ´±±µ ¿¬ ¬¸» ô ¿- ©»´´ ¿- ¬¸» ²±¬»-Ù®±±ª§ Û½´·°-» °´«¹·² ¸±³» °¿¹»
º±® ¬¸» ¿²¼ òÓï ®»´»¿-» Óî ®»´»¿-»
Ò»© º»¿¬«®»-
ß²±²§³±«- ײ²»® Ý´¿--»- ¿²¼ Ò»-¬»¼ Ý´¿--»-
ß´¬¸±«¹¸ ±º¬»²¬·³»- ½´±-«®»- ¿²¼ ³¿°- ½±»®½·±² -«ºº·½»ô ¬¸»®» ¿®» -¬·´´ ¿®»¿- ©¸»®» ¬¸» ´¿½µ ±º ß²±²§³±«- ײ²»® Ý´¿--»- øß×Ý÷ ¿²¼ Ò»-¬»¼
Ý´¿--»- øÒÝ÷ ½¿² ¾» °®±¾´»³¿¬·½ò ̸¿¬ù- ©¸§ ©» ¼»½·¼»¼ ¬± »ª»²¬«¿´´§ ·³°´»³»²¬ ß×Ý ¿²¼ ÒÝ ·² Ù®±±ª§ ïòéò
Þ» Ý¿®»º«´
̸» ·³°´»³»²¬¿¬·±² ±º ß×Ý ¿²¼ ÒÝ º±´´±©- ¬¸» Ö¿ª¿ ´»¿¼ô ¾«¬ §±« -¸±«´¼ ²±¬ ¬¿µ» ±«¬ ¬¸» Ö¿ª¿ Ô¿²¹«¿¹» Í°»½ ¿²¼ µ»»°
-¸¿µ·²¹ ¬¸» ¸»¿¼ ¿¾±«¬ ¬¸·²¹- ¬¸¿¬ ¿®» ¼·ºº»®»²¬ò ̸» ·³°´»³»²¬¿¬·±² ¼±²» ´±±µ- ³«½¸ ´·µ» ©¸¿¬ ©» ¼± º±® ¹®±±ª§ò´¿²¹òÝ´±-«®»ô
©·¬¸ -±³» ¾»²»º·¬- ¿²¼ -±³» ¼·ºº»®»²½»-ò ß½½»--·²¹ °®·ª¿¬» º·»´¼- ¿²¼ ³»¬¸±¼- º±® »¨¿³°´» ½¿² ¾»½±³» ¿ °®±¾´»³ô ¾«¬ ±² ¬¸»
±¬¸»® ¸¿²¼ ´±½¿´ ª¿®·¿¾´»- ¼±²ù¬ ¸¿ª» ¬± ¾» º·²¿´ò
Ò»-¬»¼ ͬ¿¬·½ Ý´¿--»-
Ø»®»ù- ¿² »¨¿³°´» ±º Ò»-¬»¼ ͬ¿¬·½ Ý´¿--»-æ
½´¿-- ß ¥
½´¿-- Þ ¥£-¬¿¬·½
£
ßòÞø÷²»©
̸» «-¿¹» ±º -¬¿¬·½ ²»-¬»¼ ½´¿--»- ·- ¬¸» ¾»-¬ -«°°±®¬»¼ ±²»ò ׺ §±« ¿¾-±´«¬»´§ ²»»¼ ¿² ·²²»® ½´¿--ô §±« -¸±«´¼ ³¿µ» ·¬ ¿ -¬¿¬·½ ±²»ò
ß²±²§³±«- ײ²»® Ý´¿--»-
ͱ³» ±¬¸»® »¨¿³°´»-ô ¬¸·- ¬·³» º±® ß²±²§³±«- ײ²»® Ý´¿--»-æ
¾±±´»¿² ½¿´´»¼ ã º¿´-»
Ì·³»® ¬·³»® ã Ì·³»®ø÷²»©
¬·³»®ò-½¸»¼«´»ø Ì·³»®Ì¿-µø÷ ¥²»©
ª±·¼ ®«²ø÷ ¥
½¿´´»¼ ã ¬®«»
£
£ô ð÷
-´»»° ïðð
½¿´´»¼¿--»®¬
Ó±®» ·²º±®³¿¬·±²
׺ §±« ©¿²¬ ¬± ´»¿®² ¿ ¾·¬ ³±®» ¿¾±«¬ ¬¸» ½¿-»- ©¸·½¸ ¿®» ½«®®»²¬´§ -«°°±®¬»¼ ·² ïòéô §±« ½¿² ¸¿ª» ¿ ´±±µ ¿¬ ±²» ±º ±«® «²·¬ ¬»-¬-
½±ª»®·²¹ ¬¸·- ²»© º»¿¬«®»ò
ß½½»--·²¹ ¬¸» Ñ«¬»® ݱ²¬»¨¬ º®±³ ¿ Ò»-¬»¼ Ý´¿--
׺ §±« ¿®» ·² ¿ ²»-¬»¼ ½´¿-- Ç ¿²¼ ¬¸» -«®®±«²¼·²¹ ½´¿-- ·- Èô ¬¸»² §±« ½¿² ¿½½»-- ¬¸» ª¿®·¿¾´» ª ±º È ·² Ö¿ª¿ ¾§ Èò¬¸·-òªò Ù®±±ª§ ¼±»- ²±¬ -«°°±®¬
¬¸·- -§²¬¿¨ò
Ý®»¿¬·²¹ ײ-¬¿²½»- ±º Ò±²óͬ¿¬·½ ײ²»® Ý´¿--»-
ײ Ö¿ª¿ §±« ½¿² ¼± ¬¸·-æ
剩余1268页未读,继续阅读
RJCHEN1985
- 粉丝: 15
- 资源: 35
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于JSP水产品销售系统源码.zip
- 基于JSP手机商城管理系统源码.zip
- 5.3.1_1二叉树的先中后序遍历.mp420240404-134540.png
- 基于JSP实现一个C语言教学网站平台源码.zip
- 抖音快手-课程网盘链接提取码下载 .txt
- 934742083249391XGOBOTV1.2.4.apk
- 课程设计基于OpenCV的材料缺陷检测程序python源码(含超详细注释).zip
- 基于python和百度EsayDL实现自动驾驶算法+基于ESP32开发板作为智能车主控芯片的自动驾驶智能车项目+源码(高分项目)
- Centos7-离线安装-MySQL5-7-31-tar包安装
- 蓝海平台带货-课程网盘链接提取码下载 .txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0