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

groovy 77

#Groovy
Groovy 执行系统命令获取本机名字

#!/usr/bin/evn groovy println 'hostname'.execute().text

2015-12-14 641

#Groovy
groovy输出1-10

for(int i=1;i<11;i++) { println(i); }

2015-12-14 163

#Groovy
grails处理json数据

import grails.converters.JSON class User{ String nickname Integer age } class TestControll…

2015-12-14 686

#Groovy
groovy控作sql的高级用法

def sql = Sql.newInstance("jdbc:mysql://localhost:3306/mydb", "user", "pswd", "com.mysql.j…

2015-12-14 724

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

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

2015-12-14 351

#Groovy
时间线计算代码

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

2015-12-14 833

#Groovy
连接SQL Server

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

2015-12-14 345

#Groovy
gorm的criteria查询

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

2015-12-14 262

#Groovy
groovy闭包的创建和调用

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

2015-12-14 168

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

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

2015-12-14 627

#Groovy
计算文件SHA1散列值

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

2015-12-14 409

#Groovy
groovy Date 格式化

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

2015-12-14 420