Groovyã«ã¯groovy.lang.Writableã¨ããã¤ã³ã¿ã¼ãã§ã¼ã¹ãããã¾ããå®ç¾©ã¯ä»¥ä¸ã®æãã package groovy.lang; interface Writable { Writer writeTo(Writer out); } ã¾ããã¯ãã¼ã¸ã£ã«ã¯asWritable()ã¨ããã¡ã½ãããããããã¯ãã¼ã¸ã£å¼æ°ã§ããåºåã¹ããªã¼ã outã«å¯¾ãã¦åºåå¦çãè¡ãã¯ãã¼ã¸ã£ãããWritableã¤ã³ã¿ã¼ãã§ã¼ã¹ãå®è£ ããã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã«å¤æãã¾ããã¤ã¾ãã x = { out -> /* outã«å¯¾ããåºåå¦ç */ }.asWritable() ã¯ã class Hoge implements Writable { Writer writeTo(Writer out) { /* outã«å¯¾ããåºåå¦ç */ } } x = new Hoge() ã¨ã ãããç価ã§ã
{{#tags}}- {{label}}
{{/tags}}