本文整理汇总了Java中org.seasar.struts.annotation.Required类的典型用法代码示例。如果您正苦于以下问题:Java Required类的具体用法?Java Required怎么用?Java Required使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Required类属于org.seasar.struts.annotation包,在下文中一共展示了Required类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateField
import org.seasar.struts.annotation.Required; //导入依赖的package包/类
/**
* @throws Exception
*/
public void testCreateField() throws Exception {
Field field = BbbAction.class.getDeclaredField("hoge");
Required r = field.getAnnotation(Required.class);
Map<String, Object> props = AnnotationUtil.getProperties(r);
org.apache.commons.validator.Field f = customizer.createField("hoge",
"required", props, validatorResources);
assertEquals("hoge", f.getProperty());
assertEquals("required", f.getDepends());
org.apache.commons.validator.Msg m = f.getMessage("required");
assertNotNull(m);
assertEquals("errors.required", m.getKey());
assertEquals("required", m.getName());
assertTrue(m.isResource());
assertNull(m.getBundle());
org.apache.commons.validator.Arg a = f.getArg("required", 0);
assertNotNull(a);
assertEquals("labels.hoge", a.getKey());
assertNull(a.getName());
assertTrue(a.isResource());
assertNull(a.getBundle());
}
示例2: testGetValidatorName
import org.seasar.struts.annotation.Required; //导入依赖的package包/类
/**
* @throws Exception
*/
public void testGetValidatorName() throws Exception {
Field field = BbbAction.class.getDeclaredField("hoge");
Required r = field.getAnnotation(Required.class);
Validator v = r.annotationType().getAnnotation(Validator.class);
assertEquals("required", customizer.getValidatorName(v));
}
示例3: testRegisterValidator
import org.seasar.struts.annotation.Required; //导入依赖的package包/类
/**
* @throws Exception
*/
public void testRegisterValidator() throws Exception {
Map<String, Form> forms = new HashMap<String, Form>();
Form form = new Form();
forms.put("execute", form);
Form form2 = new Form();
forms.put("execute2", form2);
Field field = BbbAction.class.getDeclaredField("hoge");
Required r = field.getAnnotation(Required.class);
Map<String, Object> props = AnnotationUtil.getProperties(r);
customizer.registerValidator("hoge", "required", props,
validatorResources, forms);
assertNotNull(form.getField("hoge"));
assertNotNull(form2.getField("hoge"));
}
示例4: testProcessAnnotation
import org.seasar.struts.annotation.Required; //导入依赖的package包/类
/**
* @throws Exception
*/
public void testProcessAnnotation() throws Exception {
Map<String, Form> forms = new HashMap<String, Form>();
Form form = new Form();
forms.put("execute", form);
Field field = BbbAction.class.getDeclaredField("hoge");
Required r = field.getAnnotation(Required.class);
customizer.processAnnotation("hoge", r, validatorResources, forms);
assertNotNull(form.getField("hoge"));
}