本文整理汇总了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;未经允许,请勿转载。 |
请发表评论