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

groovy 77

#Groovy
grails默认全局gorm配置

//默认实体约束 grails.gorm.default.constraints = { '*'(nullable:true, blank:true) } //默认映射 grail…

2015-12-14 421

#Groovy
Groovy实现Ruby的case .. when表达式

def match(subject, closure) { def whenMap = [:], otherwise = null closure.when = { map -&g…

2015-12-14 357

#Groovy
使用groovy插件保存ci的状态文件

/** * @author petert * @since V1.0 * To save all logs into file if status is not success *…

2015-12-14 375

#Groovy
groovy grails 动态方法一例

//定义一个类 class GlobalService{ def grailsApplication def propertyMissing(String name){ grail…

2015-12-14 250

#Groovy
处理二进制文件

//---------------------------------------------------------------------------------- // Ja…

2015-12-14 366

#Groovy
gorm批量删除

def batchDelete(Class entityClass,ids){ entityClass.executeUpdate("delete ${entityClass.na…

2015-12-14 347

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

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

2015-12-14 778

#Groovy
groovy基本mysql查询代码

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

2015-12-14 124

#Groovy
grails 通过applicationContext获取bean

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

2015-12-14 976

#Groovy
Groovy计算个人所得税。

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

2015-12-14 915

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

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

2015-12-14 667

#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 452