Groovy @Vetoable 的用法

2015-12-14 0 718
Groovy @Vetoable 的用法
import java.beans.*
import groovy.beans.Vetoable

class Trumpetist {
    @Vetoable String name 
}

def me = new Trumpetist()
me.vetoableChange = { PropertyChangeEvent pce ->
    if (pce.newValue.contains('z')) 
        throw new PropertyVetoException("The letter 'z' is not allowed in name", pce)
}

me.name = "asd"
me.name = "z" 

遇见资源网 groovy Groovy @Vetoable 的用法 http://www.ox520.com/13724.html

上一篇:

已经没有上一篇了!

下一篇:

已经没有下一篇了!

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务