本文整理汇总了Java中org.hibernate.validator.internal.engine.path.PathImpl.createPathFromString方法的典型用法代码示例。如果您正苦于以下问题:Java PathImpl.createPathFromString方法的具体用法?Java PathImpl.createPathFromString怎么用?Java PathImpl.createPathFromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.validator.internal.engine.path.PathImpl
的用法示例。
在下文中一共展示了PathImpl.createPathFromString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.hibernate.validator.internal.engine.path.PathImpl; //导入方法依赖的package包/类
/**
* Validate a bean of given declared class.
*
* @param bean
* the bean to validate.
* @param parameter
* the runtime annotations of this parameter.
* @param validationErrors
* the errors list to fill.
*/
private void validate(final Object bean, final Method method, final Parameter parameter, final int index,
final Set<ConstraintViolation<?>> validationErrors) {
if (bean == null) {
// Parameter is null, is it manually checked of managed by CXF for
// multipart?
// All non-body parameters are required by default
final PathImpl propertyPath = PathImpl.createPathFromString(method.getName());
propertyPath.addParameterNode(parameter.getName(), index);
validationErrors.add(ConstraintViolationImpl.forParameterValidation(NotNull.class.getName(), null, null, "interpolated", null,
null, null, null, propertyPath, NOT_NULL_DESCRIPTOR, null, null, null));
return;
}
final Class<?> clazz = bean.getClass();
if (Collection.class.isAssignableFrom(clazz)) {
validate((Collection<?>) bean, validationErrors);
} else if (clazz.isArray()) {
validate((Object[]) bean, validationErrors);
} else {
validateSimpleBean(bean, validationErrors);
}
}
示例2: testConstraintViolationExceptionParameter
import org.hibernate.validator.internal.engine.path.PathImpl; //导入方法依赖的package包/类
@Test
public void testConstraintViolationExceptionParameter() {
final Wine bean = new Wine();
final Set<ConstraintViolation<?>> violations = new LinkedHashSet<>();
final ConstraintHelper helper = new ConstraintHelper();
final ConstraintDescriptor<NotEmpty> notEmptyNameDescriptor = new ConstraintDescriptorImpl<>(helper, (Member) null,
getAnnotation("name", NotEmpty.class), ElementType.FIELD);
PathImpl path = PathImpl.createPathFromString("name");
violations.add(ConstraintViolationImpl.<Wine> forParameterValidation("name-Empty", null, null, "interpolated", Wine.class, bean, new Object(),
"value", path, notEmptyNameDescriptor, ElementType.PARAMETER, null, null));
path.addParameterNode("parameter1", 0);
final ConstraintViolationException violationException = Mockito.mock(ConstraintViolationException.class);
Mockito.when(violationException.getConstraintViolations()).thenReturn(violations);
final ValidationJsonException validationJsonException = new ValidationJsonException(violationException);
Assert.assertFalse(validationJsonException.getErrors().isEmpty());
Assert.assertEquals("{parameter1=[{rule=name-Empty}]}", validationJsonException.getErrors().toString());
}
示例3: getPropertyPath
import org.hibernate.validator.internal.engine.path.PathImpl; //导入方法依赖的package包/类
@Override
public Path getPropertyPath() {
return PathImpl.createPathFromString(propertyPath);
}
示例4: setup
import org.hibernate.validator.internal.engine.path.PathImpl; //导入方法依赖的package包/类
@Before
public void setup() {
validator = new PointLocationValidator();
context = new ConstraintValidatorContextImpl(null, null, PathImpl.createPathFromString("WOW"), null);
}
示例5: getPropertyPath
import org.hibernate.validator.internal.engine.path.PathImpl; //导入方法依赖的package包/类
@Override
public Path getPropertyPath() {
return PathImpl.createPathFromString(this.propertyPath);
}
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:5,代码来源:SerializeableConstraintValidationImpl.java
示例6: instantiate
import org.hibernate.validator.internal.engine.path.PathImpl; //导入方法依赖的package包/类
/**
* instantiate a path implementation.
*
* @param streamReader serialization stream reader
* @return path implementation
* @throws SerializationException when deserialization fails
*/
public static PathImpl instantiate(final SerializationStreamReader streamReader)
throws SerializationException {
final String propertyPath = streamReader.readString();
return PathImpl.createPathFromString(propertyPath);
}