2010.10.14 at Tajimi



def speaker = new Cast(name:”T.Yamamoto”,version:”TI-2010-10-14”)
def name='World'                     def list = ["Hello", "   ", "World"]
println "Hello $name!"               list.each{
                                       print it
                                     }


    class Greet {
      def name
      Greet(who) { name = who[0].toUpperCase() +who[1..-1] }
      def salute() { println "Hello $name!" }
    }
    def g = new Greet('world')
    // create object
    g.salute()
import java.util.Date;                       }                                             return this.black;
                                             public Integer getColorId() {                 }
public class Color {                           return this.colorId;                        public void setBlack(String black) {
 private Integer colorId;                    }                                               this.black = black;
 private String colorName;                   public void setColorId(Integer colorId) {     }
 private String cyan;                          this.colorId = colorId;                     public String getRgb() {
 private String magenta;                     }                                               return this.rgb;
 private String yellow;                      public String getColorName() {                }
 private String black;                         return this.colorName;                      public void setRgb(String rgb) {
 private String rgb;                         }                                               this.rgb = rgb;
 private String sysIpaddress;                public void setColorName(String               }
 private Date sysLastmodified;               colorName) {                                   public String getSysIpaddress() {
 private Integer sysUid;                       this.colorName = colorName;                   return this.sysIpaddress;
 public Color(Integer colorId, String        }                                             }
colorName, String cyan,                      public String getCyan() {                     public void setSysIpaddress(String
    String magenta, String yellow, String      return this.cyan;                         sysIpaddress) {
black, String rgb,                           }                                               this.sysIpaddress = sysIpaddress;
    String sysIpaddress, Date                public void setCyan(String cyan) {            }
sysLastmodified, Integer sysUid) {              this.cyan = cyan;                           public Date getSysLastmodified() {
   this.colorId = colorId;                   }                                               return this.sysLastmodified;
   this.colorName = colorName;               public String getMagenta() {                  }
   this.cyan = cyan;                           return this.magenta;                        public void setSysLastmodified(Date
   this.magenta = magenta;                   }                                           sysLastmodified) {
   this.yellow = yellow;                     public void setMagenta(String magenta) {        this.sysLastmodified = sysLastmodified;
   this.black = black;                         this.magenta = magenta;                     }
   this.rgb = rgb;                           }                                             public Integer getSysUid() {
   this.sysIpaddress = sysIpaddress;         public String getYellow() {                     return this.sysUid;
   this.sysLastmodified = sysLastmodified;       return this.yellow;                         }
   this.sysUid = sysUid;                     }                                             public void setSysUid(Integer sysUid) {
 }                                           public void setYellow(String yellow) {          this.sysUid = sysUid;
 public Color() {}                             this.yellow = yellow;                       }
 public Color(Integer colorId) {             }                                           }
   this.colorId = colorId;                   public String getBlack() {
class Color {
                         Integer colorId
                         String colorName
                         String cyan,magenta,yellow,black,rgb
                         String sysIpaddress
                         Date sysLastmodified
                         Integer sysUid
                       }

class Color {
  Integer colorId, sysUid
  String colorName,cyan,magenta,yellow,black,rgb,sysIpaddress
  Date sysLastmodified
}
public class HelloWorld {
  String name;

    public void setName(String name){
      this.name = name;
    }
    public String getName(){
      return name;
    }

    public String greet(){
      return "Hello "+name;
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld();
      helloWorld.setName("Groovy");
      System.out.println(helloWorld.greet());
    }
}
public class HelloWorld {
  String name;

    public void setName(String name){
      this.name = name;
    }
    public String getName(){
      return name;
    }

    public String greet(){
      return "Hello "+name;
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld();
      helloWorld.setName("Groovy");
      System.out.println(helloWorld.greet());
    }
}
public class HelloWorld {
  String name

    public void setName(String name){
      this.name = name
    }
    public String getName(){
      return name
    }

    public String greet(){
      return "Hello "+name
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld()
      helloWorld.setName("Groovy")
      System.out.println(helloWorld.greet())
    }
}
public class HelloWorld {
  String name

    public String greet(){
      return "Hello "+name
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld()
      helloWorld.setName("Groovy")
      System.out.println(helloWorld.greet())
    }
}
public class HelloWorld {
  String name

    public String greet(){
      return "Hello "+name
    }
}

HelloWorld helloWorld = new HelloWorld()
helloWorld.setName("Groovy")
System.out.println(helloWorld.greet())
class HelloWorld {
  String name

    def greet(){
      return "Hello "+name
    }
}

def helloWorld = new HelloWorld()
helloWorld.setName("Groovy")
println(helloWorld.greet())
class HelloWorld {
  String name

    def greet(){
      return "Hello "+name
    }
}

def helloWorld = new HelloWorld()
helloWorld.name = "Groovy"
println helloWorld.greet()
class HelloWorld {
  String name

    def greet(){ "Hello $name"}
}

def helloWorld = new HelloWorld()
helloWorld.name = "Groovy"
println helloWorld.greet()
class HelloWorld {
  String name
  def greet(){ "Hello $name"}
}

def helloWorld = new HelloWorld(name: "Groovy")
println helloWorld.greet()
@Grab('com.google.code.jcouchdb:jcouchdb:1.0.1-1')
import org.jcouchdb.db.Database
Database db = new Database(
    "localhost", "example_xmldo"
  )
db.createDocument(
    [name:'       ',comment:'          '])
Groovy


G*(            )
mailService.send to: 'foobar@gmail.com',
        subject: 'Hello World',
        htmlBody: '<bold>Hello</bold>'
import com.google.appengine.api.datastore.Entity

def person = new Entity("person")
person['name'] = "            "
person.age = 18

println person.name
person.save()

def q = new Query('person')
def list = datastoreService.prepare(q).asList(
                Builder.withLimit(20).offset(0) )
person.delete()
29
30
31
% grails run-app




                   38
class Chat {
  String message

    Date dateCreated
    Date lastUpdated
                               class ChatController {
    static constraints = {        static scaffold = true
      message nullable:false   }
      dateCreated()
      lastUpdated()
    }
}
Q&A
43

多治見IT勉強会 Groovy Grails

  • 1.
    2010.10.14 at Tajimi defspeaker = new Cast(name:”T.Yamamoto”,version:”TI-2010-10-14”)
  • 6.
    def name='World' def list = ["Hello", " ", "World"] println "Hello $name!" list.each{ print it } class Greet { def name Greet(who) { name = who[0].toUpperCase() +who[1..-1] } def salute() { println "Hello $name!" } } def g = new Greet('world') // create object g.salute()
  • 7.
    import java.util.Date; } return this.black; public Integer getColorId() { } public class Color { return this.colorId; public void setBlack(String black) { private Integer colorId; } this.black = black; private String colorName; public void setColorId(Integer colorId) { } private String cyan; this.colorId = colorId; public String getRgb() { private String magenta; } return this.rgb; private String yellow; public String getColorName() { } private String black; return this.colorName; public void setRgb(String rgb) { private String rgb; } this.rgb = rgb; private String sysIpaddress; public void setColorName(String } private Date sysLastmodified; colorName) { public String getSysIpaddress() { private Integer sysUid; this.colorName = colorName; return this.sysIpaddress; public Color(Integer colorId, String } } colorName, String cyan, public String getCyan() { public void setSysIpaddress(String String magenta, String yellow, String return this.cyan; sysIpaddress) { black, String rgb, } this.sysIpaddress = sysIpaddress; String sysIpaddress, Date public void setCyan(String cyan) { } sysLastmodified, Integer sysUid) { this.cyan = cyan; public Date getSysLastmodified() { this.colorId = colorId; } return this.sysLastmodified; this.colorName = colorName; public String getMagenta() { } this.cyan = cyan; return this.magenta; public void setSysLastmodified(Date this.magenta = magenta; } sysLastmodified) { this.yellow = yellow; public void setMagenta(String magenta) { this.sysLastmodified = sysLastmodified; this.black = black; this.magenta = magenta; } this.rgb = rgb; } public Integer getSysUid() { this.sysIpaddress = sysIpaddress; public String getYellow() { return this.sysUid; this.sysLastmodified = sysLastmodified; return this.yellow; } this.sysUid = sysUid; } public void setSysUid(Integer sysUid) { } public void setYellow(String yellow) { this.sysUid = sysUid; public Color() {} this.yellow = yellow; } public Color(Integer colorId) { } } this.colorId = colorId; public String getBlack() {
  • 8.
    class Color { Integer colorId String colorName String cyan,magenta,yellow,black,rgb String sysIpaddress Date sysLastmodified Integer sysUid } class Color { Integer colorId, sysUid String colorName,cyan,magenta,yellow,black,rgb,sysIpaddress Date sysLastmodified }
  • 10.
    public class HelloWorld{ String name; public void setName(String name){ this.name = name; } public String getName(){ return name; } public String greet(){ return "Hello "+name; } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld(); helloWorld.setName("Groovy"); System.out.println(helloWorld.greet()); } }
  • 11.
    public class HelloWorld{ String name; public void setName(String name){ this.name = name; } public String getName(){ return name; } public String greet(){ return "Hello "+name; } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld(); helloWorld.setName("Groovy"); System.out.println(helloWorld.greet()); } }
  • 12.
    public class HelloWorld{ String name public void setName(String name){ this.name = name } public String getName(){ return name } public String greet(){ return "Hello "+name } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld() helloWorld.setName("Groovy") System.out.println(helloWorld.greet()) } }
  • 13.
    public class HelloWorld{ String name public String greet(){ return "Hello "+name } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld() helloWorld.setName("Groovy") System.out.println(helloWorld.greet()) } }
  • 14.
    public class HelloWorld{ String name public String greet(){ return "Hello "+name } } HelloWorld helloWorld = new HelloWorld() helloWorld.setName("Groovy") System.out.println(helloWorld.greet())
  • 15.
    class HelloWorld { String name def greet(){ return "Hello "+name } } def helloWorld = new HelloWorld() helloWorld.setName("Groovy") println(helloWorld.greet())
  • 16.
    class HelloWorld { String name def greet(){ return "Hello "+name } } def helloWorld = new HelloWorld() helloWorld.name = "Groovy" println helloWorld.greet()
  • 17.
    class HelloWorld { String name def greet(){ "Hello $name"} } def helloWorld = new HelloWorld() helloWorld.name = "Groovy" println helloWorld.greet()
  • 18.
    class HelloWorld { String name def greet(){ "Hello $name"} } def helloWorld = new HelloWorld(name: "Groovy") println helloWorld.greet()
  • 20.
    @Grab('com.google.code.jcouchdb:jcouchdb:1.0.1-1') import org.jcouchdb.db.Database Database db= new Database(     "localhost", "example_xmldo"   ) db.createDocument(     [name:' ',comment:' '])
  • 21.
  • 25.
    mailService.send to: 'foobar@gmail.com', subject: 'Hello World', htmlBody: '<bold>Hello</bold>'
  • 26.
    import com.google.appengine.api.datastore.Entity def person= new Entity("person") person['name'] = " " person.age = 18 println person.name person.save() def q = new Query('person') def list = datastoreService.prepare(q).asList( Builder.withLimit(20).offset(0) ) person.delete()
  • 29.
  • 30.
  • 31.
  • 38.
  • 40.
    class Chat { String message Date dateCreated Date lastUpdated class ChatController { static constraints = { static scaffold = true message nullable:false } dateCreated() lastUpdated() } }
  • 42.
  • 43.