首页 软件开发 代码片段 groovy ( Page 4 )

groovy 77

#Groovy
groovy读取类的函数签名的脚本

if (args) { def className = args[0] def theClass = Class.forName(className) def theMetaCla…

2015-12-14 794

#Groovy
groovy基本mysql查询代码

package com.hongyuan.db import groovy.sql.Sql class DB { static main(args) { //创建查询对象 def …

2015-12-14 142

#Groovy
grails 通过applicationContext获取bean

class ShopService{ def grailsApplication def test(){ grailsApplication.mainContext.getBean…

2015-12-14 997

#Groovy
Groovy计算个人所得税。

def salary=7200; def tax=0.00; //只定义到了第5档,这个已经很难达到了 def taxRateMap=[3500:0.03,5000:0.1,800…

2015-12-14 934

#Groovy
groovy 关键字 in 判断集合包含的用法

def list = [1,2,3,4] println (1 in list)// print true

2015-12-14 687

#Groovy
grooy随机生成合法身份证号码的脚本

def rand = new Random() def w = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] def …

2015-12-14 469

#Groovy
Groovy脚本替换多文件中的文本

def currentDir = new File("d:/bakup"); def backupFile; def fileText; //Replace the content…

2015-12-14 223

#Groovy
对db4o的再包装

/** * */ @Typed package org.lucifer.db4o import org.lucifer.util.MyLogger import com.db4o.…

2015-12-14 494

#Groovy
重命名文件

//---------------------------------------------------------------------------------- names…

2015-12-14 366

#Groovy
groovy对双目运算符语法的改进

//一般的双目运算符是这样 String name=""; String txt = (!name.equals("")) ? name : "123" //groovy小改进了一…

2015-12-14 846

#Groovy
Groovy的times循环方法

for (i = 0; i < 5; ++i) { println i }

2015-12-14 518

#Groovy
Groovy菜鸟来解决"易语言难题”

(123..329).each {if(((it+"${it*2}"+it*3).replaceAll('0','').toCharArray() as Set).size()==…

2015-12-14 419