當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。