当前位置: 首页>>代码示例>>Java>>正文


Java Length类代码示例

本文整理汇总了Java中org.hibernate.validator.constraints.Length的典型用法代码示例。如果您正苦于以下问题:Java Length类的具体用法?Java Length怎么用?Java Length使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Length类属于org.hibernate.validator.constraints包,在下文中一共展示了Length类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValidator

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
private static Optional<Validator> getValidator(Annotation annotation) {
	Validator validator = null;

	if (isValidable(annotation)) {
		if (annotation instanceof Range || annotation instanceof Length) {
			validator = new RangeValidator(annotation);
		} else if (annotation instanceof Pattern) {
			validator = new PatternValidator(annotation);
		} else {
			validator = new DefaultValidator(annotation);
		}
	}
	return Optional.ofNullable(validator);
}
 
开发者ID:damianwajser,项目名称:spring-rest-commons-options,代码行数:15,代码来源:ValidatorFactory.java

示例2: testConstraintViolationException

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Test
public void testConstraintViolationException() {
	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);
	final ConstraintDescriptor<NotEmpty> notEmptyGrapesDescriptor = new ConstraintDescriptorImpl<>(helper, (Member) null,
			getAnnotation("grapes", NotEmpty.class), ElementType.FIELD);
	final ConstraintDescriptor<Length> lengthNameDescriptor = new ConstraintDescriptorImpl<>(helper, (Member) null,
			getAnnotation("name", Length.class), ElementType.FIELD);
	violations.add(ConstraintViolationImpl.<Wine> forBeanValidation("name-Empty", null, null, "interpolated", Wine.class, bean, new Object(),
			"value", PathImpl.createPathFromString("name"), notEmptyNameDescriptor, ElementType.FIELD, null));
	violations.add(ConstraintViolationImpl.<Wine> forBeanValidation("name-length", null, null, "interpolated", Wine.class, bean, new Object(),
			"value", PathImpl.createPathFromString("name"), lengthNameDescriptor, ElementType.FIELD, null));
	violations.add(ConstraintViolationImpl.<Wine> forBeanValidation("grapes-Empty", null, null, "interpolated", Wine.class, bean, new Object(),
			"value", PathImpl.createPathFromString("grapes"), notEmptyGrapesDescriptor, ElementType.FIELD, null));

	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("{name=[{rule=name-Empty}, {rule=name-length, parameters={min=0, max=50}}], grapes=[{rule=grapes-Empty}]}",
			validationJsonException.getErrors().toString());
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:29,代码来源:ValidationJsonExceptionTest.java

示例3: getBytearrayId

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=64, message="bytearray_id_长度必须介于 0 和 64 之间")
public String getBytearrayId() {
	return bytearrayId;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActHiVarinst.java

示例4: getTaskId

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=64, message="task_id_长度必须介于 0 和 64 之间")
public String getTaskId() {
	return taskId;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActHiComment.java

示例5: getProcInstId

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=64, message="proc_inst_id_长度必须介于 0 和 64 之间")
public String getProcInstId() {
	return procInstId;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActHiComment.java

示例6: getAction

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=255, message="action_长度必须介于 0 和 255 之间")
public String getAction() {
	return action;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActHiComment.java

示例7: getMessage

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=4000, message="message_长度必须介于 0 和 4000 之间")
public String getMessage() {
	return message;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActHiComment.java

示例8: getRev

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=11, message="rev_长度必须介于 0 和 11 之间")
public String getRev() {
	return rev;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActRuVariable.java

示例9: getActName

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=255, message="act_name_长度必须介于 0 和 255 之间")
public String getActName() {
	return actName;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActHiActinst.java

示例10: getName

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=1, max=255, message="name_长度必须介于 1 和 255 之间")
public String getName() {
	return name;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActRuVariable.java

示例11: getExecutionId

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=64, message="execution_id_长度必须介于 0 和 64 之间")
public String getExecutionId() {
	return executionId;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActHiTaskinst.java

示例12: getText

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=4000, message="text_长度必须介于 0 和 4000 之间")
public String getText() {
	return text;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActRuVariable.java

示例13: getText2

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=4000, message="text2_长度必须介于 0 和 4000 之间")
public String getText2() {
	return text2;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActRuVariable.java

示例14: getType

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=1, max=255, message="type_长度必须介于 1 和 255 之间")
public String getType() {
	return type;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActRuJob.java

示例15: getLockOwner

import org.hibernate.validator.constraints.Length; //导入依赖的package包/类
@Length(min=0, max=255, message="lock_owner_长度必须介于 0 和 255 之间")
public String getLockOwner() {
	return lockOwner;
}
 
开发者ID:xiaohelong,项目名称:ActivitiOrFlowableProcessInstanceCloneSolution,代码行数:5,代码来源:ActRuJob.java


注:本文中的org.hibernate.validator.constraints.Length类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。