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

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

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

ValidatorAction.getName介绍

[英]Gets the name of the validator action.
[中]获取验证程序操作的名称。

代码示例

代码示例来源:origin: commons-validator/commons-validator

/**
 * Add a <code>ValidatorAction</code> to the resource.  It also creates an
 * instance of the class based on the <code>ValidatorAction</code>s
 * classname and retrieves the <code>Method</code> instance and sets them
 * in the <code>ValidatorAction</code>.
 * @param va The validator action.
 */
public void addValidatorAction(ValidatorAction va) {
  va.init();
  getActions().put(va.getName(), va);
  if (getLog().isDebugEnabled()) {
    getLog().debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname());
  }
}

代码示例来源:origin: commons-validator/commons-validator

/**
 * Executes the given ValidatorAction and all ValidatorActions that it
 * depends on.
 * @return true if the validation succeeded.
 */
private boolean validateForRule(
  ValidatorAction va,
  ValidatorResults results,
  Map<String, ValidatorAction> actions,
  Map<String, Object> params,
  int pos)
  throws ValidatorException {
  ValidatorResult result = results.getValidatorResult(this.getKey());
  if (result != null && result.containsAction(va.getName())) {
    return result.isValid(va.getName());
  }
  if (!this.runDependentValidators(va, results, actions, params, pos)) {
    return false;
  }
  return va.executeValidationMethod(this, params, results, pos);
}

代码示例来源:origin: org.andromda.cartridges/andromda-jsf-cartridge-components

/**
 * @see Object#toString()
 */
@Override
public String toString()
{
  return super.toString() + ":formId=" + this.formId + ", validatorAction="
    + (this.validatorAction != null ? this.validatorAction.getName() : null);
}

代码示例来源:origin: org.springmodules/spring-modules-validation

/**
 * Gets the <code>ActionError</code> based on the <code>ValidatorAction</code> message and the <code>Field</code>'s
 * arg objects.
 * <p/>
 */
public static String getMessageKey(ValidatorAction va, Field field) {
  return (field.getMsg(va.getName()) != null ? field.getMsg(va.getName())
    : va.getMsg());
}

代码示例来源:origin: jp.terasoluna.fw/terasoluna-validator

/**
 * 配列・コレクションの要素を検証するメソッドを取得する。
 *
 * @param va ValidatorAction
 * @param paramClass 引数クラス配列
 * @return 検証メソッド
 */
protected Method getMethod(
    ValidatorAction va, @SuppressWarnings("rawtypes") Class[] paramClass) {
  String methodNameSource = va.getName();
  if (methodNameSource == null || "".equals(methodNameSource)) {
    // メソッド名指定がnullまたは空文字のときnull返却。
    return null;
  }
  // name属性から"Array"を除去したメソッド名を生成する
  // xxxxArray→validateXxxx
  char[] chars = methodNameSource.toCharArray();
  chars[0] = Character.toUpperCase(chars[0]);
  String validate = "validate" + new String(chars);
  String methodName = validate.substring(0, validate.length()
      - "Array".length());
  Method method = null;
  try {
    method = FieldChecks.class.getMethod(methodName, paramClass);
  } catch (NoSuchMethodException e) {
    return null;
  }
  return method;
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-validator

/**
 * Add a <code>ValidatorAction</code> to the resource.  It also creates an
 * instance of the class based on the <code>ValidatorAction</code>s
 * classname and retrieves the <code>Method</code> instance and sets them
 * in the <code>ValidatorAction</code>.
 * @param va The validator action.
 */
public void addValidatorAction(ValidatorAction va) {
  va.init();
  getActions().put(va.getName(), va);
  if (getLog().isDebugEnabled()) {
    getLog().debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname());
  }
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.validator

/**
 * Add a <code>ValidatorAction</code> to the resource.  It also creates an
 * instance of the class based on the <code>ValidatorAction</code>s
 * classname and retrieves the <code>Method</code> instance and sets them
 * in the <code>ValidatorAction</code>.
 * @param va The validator action.
 */
public void addValidatorAction(ValidatorAction va) {
  va.init();
  this.hActions.put(va.getName(), va);
  if (getLog().isDebugEnabled()) {
    getLog().debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname());
  }
}

代码示例来源:origin: org.apache.struts/struts-core

/**
 * Gets the locale sensitive message based on the <code>ValidatorAction</code>
 * message and the <code>Field</code>'s arg objects.
 *
 * @param messages The Message resources
 * @param locale   The locale
 * @param va       The Validator Action
 * @param field    The Validator Field
 */
public static String getMessage(MessageResources messages, Locale locale,
  ValidatorAction va, Field field) {
  String[] args = getArgs(va.getName(), messages, locale, field);
  String msg =
    (field.getMsg(va.getName()) != null) ? field.getMsg(va.getName())
                       : va.getMsg();
  return messages.getMessage(locale, msg, args);
}

代码示例来源:origin: struts/struts

/**
 * Gets the locale sensitive message based on the 
 * <code>ValidatorAction</code> message and the <code>Field</code>'s 
 * arg objects.
 * @param messages  The Message resources
 * @param locale The locale
 * @param va The Validator Action
 * @param field The Validator Field
 */
public static String getMessage(
  MessageResources messages,
  Locale locale,
  ValidatorAction va,
  Field field) {
  String args[] = getArgs(va.getName(), messages, locale, field);
  String msg =
    field.getMsg(va.getName()) != null
      ? field.getMsg(va.getName())
      : va.getMsg();
  return messages.getMessage(locale, msg, args);
}
/**

代码示例来源:origin: org.andromda.cartridges/andromda-jsf-cartridge-components

/**
 * Gets the message given the action, field and faces context.
 *
 * @param action the validator action instance.
 * @param field the field.
 * @param context the faces context.
 * @return the message
 */
public static String getMessage(
  final ValidatorAction action,
  final Field field,
  final FacesContext context)
{
  return getMessage(
    action,
    getArgs(
      action.getName(),
      field),
    context);
}

代码示例来源:origin: struts/struts

/**
 * Gets the <code>ActionMessage</code> based on the 
 * <code>ValidatorAction</code> message and the <code>Field</code>'s 
 * arg objects.
 * @param request the servlet request
 * @param va Validator action
 * @param field the validator Field
 */
public static ActionMessage getActionMessage(
  HttpServletRequest request,
  ValidatorAction va,
  Field field) {
  String args[] =
    getArgs(
      va.getName(),
      getMessageResources(request),
      RequestUtils.getUserLocale(request, null),
      field);
  String msg =
    field.getMsg(va.getName()) != null
      ? field.getMsg(va.getName())
      : va.getMsg();
  return new ActionMessage(msg, args);
}

代码示例来源:origin: struts/struts

/**
 * Gets the <code>ActionError</code> based on the 
 * <code>ValidatorAction</code> message and the <code>Field</code>'s 
 * arg objects.
 * @param request the servlet request
 * @param va Validator action
 * @param field the validator Field
 * @deprecated Use getActionMessage() instead.  This will be removed after
 * Struts 1.2.
 */
public static ActionError getActionError(
  HttpServletRequest request,
  ValidatorAction va,
  Field field) {
  String args[] =
    getArgs(
      va.getName(),
      getMessageResources(request),
      RequestUtils.getUserLocale(request, null),
      field);
  String msg =
    field.getMsg(va.getName()) != null
      ? field.getMsg(va.getName())
      : va.getMsg();
  return new ActionError(msg, args);
}

代码示例来源:origin: org.apache.struts/struts-core

/**
 * Gets the <code>ActionMessage</code> based on the
 * <code>ValidatorAction</code> message and the <code>Field</code>'s arg
 * objects.
 * <p>
 * <strong>Note:</strong> this method does not respect bundle information
 * stored with the field's &lt;msg&gt; or &lt;arg&gt; elements, and localization
 * will not work for alternative resource bundles. This method is
 * deprecated for this reason, and you should use
 * {@link #getActionMessage(Validator,HttpServletRequest,ValidatorAction,Field)}
 * instead. 
 *
 * @param request the servlet request
 * @param va      Validator action
 * @param field   the validator Field
 * @deprecated Use getActionMessage(Validator, HttpServletRequest,
 *    ValidatorAction, Field) method instead
 */
public static ActionMessage getActionMessage(HttpServletRequest request,
  ValidatorAction va, Field field) {
  String[] args =
    getArgs(va.getName(), getMessageResources(request),
      RequestUtils.getUserLocale(request, null), field);
  String msg =
    (field.getMsg(va.getName()) != null) ? field.getMsg(va.getName())
                       : va.getMsg();
  return new ActionMessage(msg, args);
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.validator

/**
 * Executes the given ValidatorAction and all ValidatorActions that it 
 * depends on.
 * @return true if the validation succeeded.
 */
private boolean validateForRule(
  ValidatorAction va,
  ValidatorResults results,
  Map actions,
  Map params,
  int pos)
  throws ValidatorException {
  ValidatorResult result = results.getValidatorResult(this.getKey());
  if (result != null && result.containsAction(va.getName())) {
    return result.isValid(va.getName());
  }
  if (!this.runDependentValidators(va, results, actions, params, pos)) {
    return false;
  }
  return va.executeValidationMethod(this, params, results, pos);
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-validator

/**
 * Executes the given ValidatorAction and all ValidatorActions that it
 * depends on.
 * @return true if the validation succeeded.
 */
private boolean validateForRule(
  ValidatorAction va,
  ValidatorResults results,
  Map<String, ValidatorAction> actions,
  Map<String, Object> params,
  int pos)
  throws ValidatorException {
  ValidatorResult result = results.getValidatorResult(this.getKey());
  if (result != null && result.containsAction(va.getName())) {
    return result.isValid(va.getName());
  }
  if (!this.runDependentValidators(va, results, actions, params, pos)) {
    return false;
  }
  return va.executeValidationMethod(this, params, results, pos);
}

代码示例来源:origin: org.springmodules/spring-modules-validation

String actionName = va.getName();

代码示例来源:origin: org.apache.struts/struts-core

HttpServletRequest request, MessageResources defaultMessages,
Locale locale, ValidatorAction va, Field field) {
Msg msg = field.getMessage(va.getName());
  return "??? " + va.getName() + "." + field.getProperty() + " ???";
Arg[] args = field.getArgs(va.getName());
String[] argValues =
  getArgValues(application, request, messages, locale, args);

代码示例来源:origin: struts/struts

Field field) {
Msg msg = field.getMessage(va.getName());
if (msg != null && !msg.isResource()) {
  return msg.getKey();
  return "??? " + va.getName() + "." + field.getProperty() + " ???";
Arg[] args = field.getArgs(va.getName());
String[] argValues = getArgValues(application, request, messages, locale, args);

代码示例来源:origin: struts/struts

Field field) {
Msg msg = field.getMessage(va.getName());
if (msg != null && !msg.isResource()) {
  return new ActionMessage(msg.getKey(), false);
  return new ActionMessage("??? " + va.getName() + "." + field.getProperty() + " ???", false);
Locale locale = RequestUtils.getUserLocale(request, null);
Arg[] args = field.getArgs(va.getName());
String[] argValues = getArgValues(application, request, messages, locale, args);

代码示例来源:origin: org.apache.struts/struts-core

Msg msg = field.getMessage(va.getName());
  return new ActionMessage("??? " + va.getName() + "."
    + field.getProperty() + " ???", false);
Locale locale = RequestUtils.getUserLocale(request, null);
Arg[] args = field.getArgs(va.getName());
String[] argValues =
  getArgValues(application, request, messages, locale, args);

相关文章