1。给代理函数加上空判断
一个组合模式的运用。代码如下: class Composite impliments IF1,IF2,IF3{ private IF1 if1; private IF2 if2; private IF2 if2; public Composite (if1,if2,if3){ } } eclipse 生成指代方法>>>>
class Composite impliments IF1,IF2,IF3{ private IF1 if1; private IF2 if2; private IF2 if2; public Composite (if1,if2,if3){ } public void method1(){ if1.method1(); } . } //正则表达式 // (\w+method\d)(\..*) if($1!=null){$0} //>>> class Composite impliments IF1,IF2,IF3{ private IF1 if1; private IF2 if2; private IF2 if2; public Composite (if1,if2,if3){ } public void method1(){ if(if1= null){ if1.method1(); } } . } //还有一个构造函数里的属性赋值: // (\w+) this.$1=$1 |