當前位置: 首頁>>代碼示例>>Java>>正文


Java ParameterNode類代碼示例

本文整理匯總了Java中javax.validation.Path.ParameterNode的典型用法代碼示例。如果您正苦於以下問題:Java ParameterNode類的具體用法?Java ParameterNode怎麽用?Java ParameterNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ParameterNode類屬於javax.validation.Path包,在下文中一共展示了ParameterNode類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: as

import javax.validation.Path.ParameterNode; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public <T extends Path.Node> T as(final Class<T> nodeType) throws ClassCastException { // NOPMD
  if (this.kind == ElementKind.BEAN && nodeType == BeanNode.class
      || this.kind == ElementKind.CONSTRUCTOR && nodeType == ConstructorNode.class
      || this.kind == ElementKind.CROSS_PARAMETER && nodeType == CrossParameterNode.class
      || this.kind == ElementKind.METHOD && nodeType == MethodNode.class
      || this.kind == ElementKind.PARAMETER && nodeType == ParameterNode.class
      || this.kind == ElementKind.PROPERTY && (nodeType == PropertyNode.class
          || nodeType == org.hibernate.validator.path.PropertyNode.class)
      || this.kind == ElementKind.RETURN_VALUE && nodeType == ReturnValueNode.class
      || this.kind == ElementKind.CONTAINER_ELEMENT && (nodeType == ContainerElementNode.class
          || nodeType == org.hibernate.validator.path.ContainerElementNode.class)) {
    return (T) this;
  }

  throw LOG.getUnableToNarrowNodeTypeException(this.getClass(), this.kind, nodeType);
}
 
開發者ID:ManfredTremmel,項目名稱:gwt-bean-validators,代碼行數:19,代碼來源:NodeImpl.java

示例2: extractCategory

import javax.validation.Path.ParameterNode; //導入依賴的package包/類
/**
 * Returns the category for this constraint violation. By default, the category returned
 * is the full path for property. You can override this method if you prefer another strategy.
 */
protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) {
	Iterator<Node> path = violation.getPropertyPath().iterator();
	Node method = path.next();
	logger.debug("Constraint violation on method {}: {}", method, violation);

	StringBuilder cat = new StringBuilder();
	cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName());// parameter name

	while (path.hasNext()) {
		cat.append(".").append(path.next());
	}

	return cat.toString();
}
 
開發者ID:caelum,項目名稱:vraptor4,代碼行數:19,代碼來源:MethodValidator.java

示例3: getFirstParameterIndex

import javax.validation.Path.ParameterNode; //導入依賴的package包/類
private int getFirstParameterIndex( Iterator<Node> node ){
	ignoreMethodName( node );
	ParameterNode parameterNode = node.next().as(ParameterNode.class);
	return parameterNode.getParameterIndex();
}
 
開發者ID:cejug,項目名稱:hurraa,代碼行數:6,代碼來源:CejugMethodValidator.java


注:本文中的javax.validation.Path.ParameterNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。