⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 invokenormalmethodfrombuilder_bug657.groovy

📁 大名鼎鼎的java动态脚本语言。已经通过了sun的认证
💻 GROOVY
字号:
/**  * <p>  * Test that ensures that:  * <ul>  *   <li>it is possible to write a builder in Groovy</li>  *   <li>it is possible to call normal methods from the builder,  *       without the methods being trapped endlessly by createNode()</li>  * </ul>  * </p>  *  * @author Guillaume Laforge  */class InvokeNormalMethodFromBuilder_Bug657 extends GroovyTestCase {    void testInvokeNormalMethod() {        def b = new Builder()        assert b.callNormalMethod() == "first"        def value = b.someNode() {}        assert value == "second"    }}class Builder extends BuilderSupport {    void setParent(Object parent, Object child) {}    Object createNode(Object name)                 { return createNode(name, [:], null) }    Object createNode(Object name, Map attributes) { return createNode(name, attributes, null) }    Object createNode(Object name, Object value)   { return createNode(name, [:], value) }    Object createNode(Object name, Map attributes, Object value) {        println "create ${name}"        return callOtherStaticallyTypedMethod()    }    String callNormalMethod()               { println "normalMethod"; return "first" }    String callOtherStaticallyTypedMethod() { println "otherMethod";  return "second" }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -