利用Groovy的动态特性删除属性

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

class A {   
   String attToRemove   
   int otherAtt   
}   
  
def a = new A()   
a.attToRemove = 1  
println a.attToRemove   
  
A.metaClass.properties.remove(A.metaClass.properties.attToRemove)   
  
println a.attToRemove // 这里抛异常了