List of usage examples for org.apache.commons.validator Arg isResource
public boolean isResource()
From source file:org.seasar.struts.customizer.ActionCustomizerTest.java
/** * @throws Exception/*from w ww . j av a 2 s . co m*/ */ 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()); }
From source file:org.springmodules.commons.validator.MessageUtils.java
/** * Get the message associated with the argument. If the resource flag is set * to false, use the text specified in the argument key directly. Otherwise, * create a MessageSourceResolvable with the argument key as its code. */// w w w .j av a 2 s.c o m public static Object getMessage(Arg arg) { if (arg.isResource()) { return createMessage(arg.getKey()); } else { return arg.getKey(); } }
From source file:org.springmodules.validation.commons.MessageUtils.java
/** * Get the message associated with the argument. If the resource flag is set * to false, use the text specified in the argument key directly. Otherwise, * create a MessageSourceResolvable with the argument key as its code. *///from w ww . java 2 s . c om public static Object getMessage(Arg arg) { if (arg.isResource()) { return MessageUtils.createMessage(arg.getKey()); } else { return arg.getKey(); } }