当前位置: 首页>>代码示例>>Java>>正文


Java Required类代码示例

本文整理汇总了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());
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:25,代码来源:ActionCustomizerTest.java

示例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));
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:10,代码来源:ActionCustomizerTest.java

示例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"));
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:18,代码来源:ActionCustomizerTest.java

示例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"));
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:13,代码来源:ActionCustomizerTest.java


注:本文中的org.seasar.struts.annotation.Required类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。