本文整理了Java中org.apache.commons.validator.Var
类的一些代码示例,展示了Var
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Var
类的具体详情如下:
包路径:org.apache.commons.validator.Var
类名称:Var
[英]A variable that can be associated with a Field
for passing in information to a pluggable validator. Instances of this class are configured with a <var> xml element.
[中]可与Field
关联的变量,用于将信息传递给可插入验证程序。这个类的实例是用<var>xml元素配置的。
代码示例来源:origin: commons-validator/commons-validator
assertEquals("var-1-1 name is wrong", "var-1-1", var11.getName());
assertEquals("var-1-1 value is wrong", "value-1-1", var11.getValue());
assertEquals("var-1-1 jstype is wrong", "jstype-1-1", var11.getJsType());
assertFalse("var-1-1 resource is true", var11.isResource());
assertNull("var-1-1 bundle is not null.", var11.getBundle());
assertEquals("var-2-1 name is wrong", "var-2-1", var21.getName());
assertEquals("var-2-1 value is wrong", "value-2-1", var21.getValue());
assertEquals("var-2-1 jstype is wrong", "jstype-2-1", var21.getJsType());
assertTrue("var-2-1 resource is false", var21.isResource());
assertEquals("var-2-1 bundle is wrong", "bundle-2-1", var21.getBundle());
assertEquals("var-2-2 name is wrong", "var-2-2", var22.getName());
assertEquals("var-2-2 value is wrong", "value-2-2", var22.getValue());
assertNull("var-2-2 jstype is not null", var22.getJsType());
assertFalse("var-2-2 resource is true", var22.isResource());
assertEquals("var-2-2 bundle is wrong", "bundle-2-2", var22.getBundle());
代码示例来源:origin: commons-validator/commons-validator
/**
* Add a <code>Var</code>, based on the values passed in, to the
* <code>Field</code>.
* @param name Name of the validation.
* @param value The Argument's value.
* @param jsType The Javascript type.
*/
public void addVar(String name, String value, String jsType) {
this.addVar(new Var(name, value, jsType));
}
代码示例来源:origin: commons-validator/commons-validator
/**
* Replace the vars value with the key/value pairs passed in.
*/
private void processVars(String key, String replaceValue) {
Iterator<String> i = getVarMap().keySet().iterator();
while (i.hasNext()) {
String varKey = i.next();
Var var = this.getVar(varKey);
var.setValue(ValidatorUtils.replace(var.getValue(), key, replaceValue));
}
}
代码示例来源:origin: org.seasar.struts/s2-struts
public void register(Field field, Map parameter) {
String pattern = (String) parameter.get("value");
Var var = new Var();
var.setName("datePattern");
var.setValue(pattern);
field.addVar(var);
}
代码示例来源:origin: commons-validator/commons-validator
/**
* Retrieve a variable's value.
* @param mainKey The Variable's key
* @return the Variable's value
*/
public String getVarValue(String mainKey) {
String value = null;
Object o = getVarMap().get(mainKey);
if (o != null && o instanceof Var) {
Var v = (Var) o;
value = v.getValue();
}
return value;
}
代码示例来源:origin: org.springmodules/spring-modules-validation
String varName = (String) varsIterator.next();
Var var = (Var) vars.get(varName);
String varValue = var.getValue();
String jsType = var.getJsType();
代码示例来源:origin: commons-validator/commons-validator
/**
* Add a <code>Var</code> to the <code>Field</code>.
* @param v The Validator Argument.
*/
public void addVar(Var v) {
this.getVarMap().put(v.getName(), v);
}
代码示例来源:origin: commons-validator/commons-validator
/**
* Makes a deep copy of a <code>Map</code> if the values are
* <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
* it is a shallow copy.
*
* @param map The source Map to copy.
*
* @return A copy of the <code>Map</code> that was passed in.
*/
public static Map<String, Object> copyMap(Map<String, Object> map) {
Map<String, Object> results = new HashMap<String, Object>();
Iterator<Entry<String, Object>> i = map.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Object> entry = i.next();
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof Msg) {
results.put(key, ((Msg) value).clone());
} else if (value instanceof Arg) {
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
}
}
return results;
}
代码示例来源:origin: org.seasar.struts/s2-struts
private void addVariable(Field field, Map var) {
String name = (String) var.get("name");
String value = (String) var.get("value");
if (StringUtil.isEmpty(value)) {
return;
}
Var v = new Var();
v.setName(name);
v.setValue(value);
field.addVar(v);
}
代码示例来源:origin: commons-validator/commons-validator
String key2 = TOKEN_START + TOKEN_VAR + key + TOKEN_END;
Var var = this.getVar(key);
String replaceValue = var.getValue();
代码示例来源:origin: struts/struts
String varName = (String) varsIterator.next();
Var var = (Var) vars.get(varName);
String varValue = var.getValue();
String jsType = var.getJsType();
代码示例来源:origin: de.knightsoft-net/gwt-commons-validator
/**
* Add a <code>Var</code> to the <code>Field</code>.
* @param v The Validator Argument.
*/
public void addVar(Var v) {
this.getVarMap().put(v.getName(), v);
}
代码示例来源:origin: commons-validator/commons-validator
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
代码示例来源:origin: org.seasar.struts/s2-struts
public void register(Field field, Map parameter) {
String pattern = (String) parameter.get("pattern");
if (StringUtil.isEmpty(pattern)) {
pattern = this.defaultPattern;
}
String strictStr = (String) parameter.get("strict");
boolean strict = this.defaultStrict;
if (!StringUtil.isEmpty(strictStr)) {
strict = BooleanConversionUtil.toPrimitiveBoolean(strictStr);
}
Var var = new Var();
if (strict) {
var.setName("datePatternStrict");
} else {
var.setName("datePattern");
}
var.setValue(pattern);
field.addVar(var);
}
代码示例来源:origin: org.apache.struts/struts-core
String varName = var.getName();
String varValue = var.getValue();
if (!var.isResource()) {
return varValue;
String bundle = var.getBundle();
MessageResources messages =
getMessageResources(application, request, bundle);
代码示例来源:origin: de.knightsoft-net/gwt-commons-validator
/**
* Replace the vars value with the key/value pairs passed in.
*/
private void processVars(String key, String replaceValue) {
Iterator<String> i = getVarMap().keySet().iterator();
while (i.hasNext()) {
String varKey = i.next();
Var var = this.getVar(varKey);
var.setValue(ValidatorUtils.replace(var.getValue(), key, replaceValue));
}
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-validator
/**
* Retrieve a variable's value.
* @param mainKey The Variable's key
* @return the Variable's value
*/
public String getVarValue(String mainKey) {
String value = null;
Object o = getVarMap().get(mainKey);
if (o != null && o instanceof Var) {
Var v = (Var) o;
value = v.getValue();
}
return value;
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-validator
/**
* Add a <code>Var</code>, based on the values passed in, to the
* <code>Field</code>.
* @param name Name of the validation.
* @param value The Argument's value.
* @param jsType The Javascript type.
*/
public void addVar(String name, String value, String jsType) {
this.addVar(new Var(name, value, jsType));
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.validator
/**
* Add a <code>Var</code> to the <code>Field</code>.
* @param v The Validator Argument.
*/
public void addVar(Var v) {
this.hVars.put(v.getName(), v);
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.validator
/**
* Makes a deep copy of a <code>Map</code> if the values are
* <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
* it is a shallow copy.
*
* @param map The source Map to copy.
*
* @return A copy of the <code>Map</code> that was passed in.
*/
public static Map copyMap(Map map) {
Map results = new HashMap();
Iterator iter = map.keySet().iterator();
while (iter.hasNext()) {
String key = (String) iter.next();
Object value = map.get(key);
if (value instanceof Msg) {
results.put(key, ((Msg) value).clone());
} else if (value instanceof Arg) {
results.put(key, ((Arg) value).clone());
} else if (value instanceof Var) {
results.put(key, ((Var) value).clone());
} else {
results.put(key, value);
}
}
return results;
}
内容来源于网络,如有侵权,请联系作者删除!