From Java to Groovy in a Few Easy Steps - DZone Java
ãJavaããGroovyã¸ãã ãããªã
å®éã«Groovy使ãå§ãã¦æã£ããã©ï¼Javaã®è³ç£ãããã°ããã»ã©ï¼æãåºããããã¹ã¯ãªããè¨èªã§ãã¨ãããããªãã¨ãããããã¨æã£ãã¨ãã«ï¼ãããå®ç¾ã§ããJavaã®ã©ã¤ãã©ãªãæãã¤ãã°ï¼Groovyã§æ¸ããæ¹ãJavaã§æ¸ãããé¥ãã«æ¥½ã
ï¼ã¨ãããï¼æãããæ¸ãããã£ã¦è¨ã£ãæ¹ããã¥ã¢ã³ã¹ãè¿ãããªã
楽ã«æ¸ããã£ã¦ã®ã¯ï¼JetGroovyã«ããã¨ããã大ããã®ã§ï¼Groovyãã®ãã®ã®è©ä¾¡ã¨ã¯è¨ããªãããã
ããã§ãï¼ããæ°æ¥ãã¹ãã³ã¼ãã¨ãã¡ããã¨ãã便å©ã¹ã¯ãªãããGroovyã§æ¸ãã¦ãã¨ããã®éã ãããããã¯ãã³ã¼ããGroovyã§ãããããããã¨æãå§ãããªã¬ã¬ã¤ã«ã
ï¼ã¯ããã¦ããã¯ä¸äºç
ã®ä¸ç¨®ãï¼
ããã¯ããã¨ï¼ãªã³ã¯å ã§æå¾ã«ç´¹ä»ãã¦ãã£ãã³ã¼ãï¼
class HelloWorld { def name def greet() { "Hello ${name}" } } def helloWorld = new HelloWorld() helloWorld.name = "Groovy" println helloWorld.greet()
ããã¯ãã¡ã¤ã«åããHelloWorld.groovyãã«ããã¨åããªããã
ps.
ãããªãã¨ãåãããããGroovyãç解ã§ãã¦ãããã ãã©ï¼Groovyã£ã¦æãããå
ãJavaã ããï¼ãããªãã ãªãã¿ãããªçºæ³ãå¿
è¦ã§ï¼ã³ã¿ããã«ãã³ã·ã§ã³ä¸ããã ããã¼ã:-P