---
title: "groovy之GOJO"
author: "VerRan"
date: "2010-07-19T15:32:54Z"
tags: ["Groovy"]
categories: ["企业架构"]
slug: "groovy-gojo"
draft: false
lastmod: "2010-07-19T15:32:54Z"
id: 716108
url: "https://verran.iteye.com/blog/716108"
---

java 的 简单对象叫做 pojo与之对应的 是groovy的gojo

```
package fist

class Staff {
	def staffId=0;
	def staffName="VerRan";
	def password="123456";
	def sex="male";
}
```

 

```
package fist;

import groovy.util.GroovyTestCase;

class StaffTest extends GroovyTestCase {
	public void test(){
			def staff=new Staff();
			println staff.staffName;
			println staff.sex;
			println staff.getStaffId()
			
			def staff2=new Staff(staffId:1,staffName:"dove",sex:"女");
			
			println staff2.staffName;
			println staff2.sex;
			println staff2.getStaffId()
			
}
```