JavaScud | Forum | JIRA | Blog |
  Dashboard > WebWork2文档中文化计划 > ... > J2SE 5 Support > DoubleRangeFieldValidator Annotation
  WebWork2文档中文化计划 Log In View a printable version of the current page.  
  DoubleRangeFieldValidator Annotation
Added by scud, last edited by scud on May 18, 2006  (view change)
Labels: 
(None)

DoubleRangeFieldValidator 标注

这个校验器检查double字段的值是否在一个指定的范围内.如果min和max都没有设置,则任何事情都不会发生.

使用

这个标注必须设置在方法级别上.

参数

参数 必填 缺省值 备注
message yes   字段错误信息
key no   语言相关的属性文件里面的i18n key.
fieldName no    
shortCircuit no false 校验器是否短路.
type yes ValidatorType.FIELD 校验器类型(ValidatorType)的枚举值(Enum value). 在这里可以是 FIELD 或者 SIMPLE.
minInclusive no   Double 属性. 最小允许的值(包含).
maxInclusive no   Double 属性. 最大允许的值(包含).
minExclusive no   Double 属性. 最小允许的值(不含).
maxExclusive no   Double 属性. 最大允许的值(不含).

如果min和max都没有设置,则任何事情都不会发生.

min和max的值必须是当作一个字符串来插入,因此 "0"会被当作一个可能的值处理.

例子

@DoubleRangeFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, minInclusive = "0.123", maxInclusive = "99.987")
Site running on a free Atlassian Confluence Open Source Project License granted to WebWork China. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.3 Build:#808 May 29, 2007) - Bug/feature request - Contact Administrators