org.apache.commons.validator.Var.setValue()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.apache.commons.validator.Var.setValue()方法的一些代码示例,展示了Var.setValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Var.setValue()方法的具体详情如下:
包路径:org.apache.commons.validator.Var
类名称:Var
方法名:setValue

Var.setValue介绍

[英]Sets the value of the variable.
[中]设置变量的值。

代码示例

代码示例来源: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: 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: org.apache.commons/com.springsource.org.apache.commons.validator

/**
 * Replace the vars value with the key/value pairs passed in.
 */
private void processVars(String key, String replaceValue) {
  Iterator i = this.hVars.keySet().iterator();
  while (i.hasNext()) {
    String varKey = (String) 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: 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: 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.seasar.struts/s2-struts

public void register(Field field, Map parameter) {
  Object value = parameter.get("value");
  String type = getType();
  Arg arg = new Arg();
  arg.setName(type);
  arg.setKey("${var:" + type + "}");
  arg.setResource(false);
  arg.setPosition(1);
  field.addArg(arg);
  Var var = new Var();
  var.setName(type);
  var.setValue(value.toString());
  field.addVar(var);
}

代码示例来源:origin: org.seasar.struts/s2-struts

public void register(Field field, Map parameter) {
  Object value = parameter.get("value");
  String charset = (String) parameter.get("charset");
  if (StringUtil.isEmpty(charset)) {
    charset = this.defaultCharset;
  }
  String type = getType();
  Arg arg = new Arg();
  arg.setName(type);
  arg.setKey("${var:" + type + "}");
  arg.setResource(false);
  arg.setPosition(1);
  field.addArg(arg);
  Var var = new Var();
  var.setName(type);
  var.setValue(value.toString());
  field.addVar(var);
  var = new Var();
  var.setName("charset");
  var.setValue(charset);
  field.addVar(var);
}

代码示例来源:origin: org.seasar.struts/s2-struts

public void register(Field field, Map parameter) {
  String pattern = (String) parameter.get("pattern");
  String messageKey = (String) parameter.get("messageKey");
  String resourceStr = (String) parameter.get("resource");
  boolean resource = true;
  if (!StringUtil.isEmpty(resourceStr)) {
    resource = BooleanConversionUtil.toPrimitiveBoolean(resourceStr);
  }
  Var var = new Var();
  var.setName("mask");
  var.setValue(pattern);
  field.addVar(var);
  if (!StringUtil.isEmpty(messageKey)) {
    Msg message = new Msg();
    message.setName("mask");
    message.setKey(messageKey);
    message.setResource(resource);
    field.addMsg(message);
  }
}

代码示例来源:origin: org.seasar.struts/s2-struts

public void register(Field field, Map parameter) {
  Object min = parameter.get("min");
  Object max = parameter.get("max");
  String type = getType();
  Arg arg = new Arg();
  arg.setName(type);
  arg.setKey("${var:min}");
  arg.setResource(false);
  arg.setPosition(1);
  field.addArg(arg);
  arg = new Arg();
  arg.setName(type);
  arg.setKey("${var:max}");
  arg.setResource(false);
  arg.setPosition(2);
  field.addArg(arg);
  Var var = new Var();
  var.setName("min");
  var.setValue(min.toString());
  field.addVar(var);
  var = new Var();
  var.setName("max");
  var.setValue(max.toString());
  field.addVar(var);
}

代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-system

Var var = new Var();
var.setName("maxlength");
var.setValue("" + length);
rules.addVar(var);

相关文章