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

groovy 77

#Groovy
grails执行sql,调用存储过程

import groovy.sql.Sql class TestService{ def dataSource//注入数据源 def execute(){ def db = new…

2015-12-14 346

#Groovy
时间线计算代码

class DateTimeUtil { static def timeLine = { def subMinute = delegate.upint(Calendar.insta…

2015-12-14 829

#Groovy
连接SQL Server

import java.sql.Connection import java.sql.DriverManager import javax.sql.DataSource impor…

2015-12-14 340

#Groovy
gorm的criteria查询

class User{ String name Account account } class Account{ Double balance } 查询:: User.withCr…

2015-12-14 258

#Groovy
groovy闭包的创建和调用

class A { private int member = 20; private method() { println ("hello"); } def publicMetho…

2015-12-14 164

#Groovy
演示用Groovy开发Android程序,实现一个IOS风格计算器界面(无计算器逻辑)

package com.aruis.android.androidhomework1 import android.app.Activity import android.grap…

2015-12-14 623

#Groovy
计算文件SHA1散列值

import java.security.MessageDigest int KB = 1024 int MB = 1024*KB File f = new File(args[0…

2015-12-14 404

#Groovy
groovy Date 格式化

// String output = new Date().format('yyyy-MM-dd HH:mm:ss')

2015-12-14 416

#Groovy
Groovy闭包的递归调用

// 递归求n! factorialProperty = { n -> if (n == 0) return 1 n * factorialProperty(n - 1) /…

2015-12-14 192

#Groovy
用switch 优化 if-else 代码

// before def fun1(a, b, c) { println("-----------------------") if (a > b || a > c)…

2015-12-14 834

#Groovy
检索页面URL地址

new URL("http://www.oschina.net").openConnection().content.text.eachMatch( /href="(http.+?…

2015-12-14 634

#Groovy
grails的UrlMapping常用配置示例

class UrlMappings { //grails框架不处理以下请求,也就是不经过grails的Controller,由web服务器处理 static excludes = …

2015-12-14 790