Java 类org.hibernate.validator.constraints.Length 实例源码

项目:bootstrap    文件:ValidationJsonExceptionTest.java   
@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());
}
项目:spring-rest-commons-options    文件:ValidatorFactory.java   
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);
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiVarinst.java   
@Length(min=0, max=64, message="bytearray_id_长度必须介于 0 和 64 之间")
public String getBytearrayId() {
    return bytearrayId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiComment.java   
@Length(min=0, max=64, message="task_id_长度必须介于 0 和 64 之间")
public String getTaskId() {
    return taskId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiComment.java   
@Length(min=0, max=64, message="proc_inst_id_长度必须介于 0 和 64 之间")
public String getProcInstId() {
    return procInstId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiComment.java   
@Length(min=0, max=255, message="action_长度必须介于 0 和 255 之间")
public String getAction() {
    return action;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiComment.java   
@Length(min=0, max=4000, message="message_长度必须介于 0 和 4000 之间")
public String getMessage() {
    return message;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuVariable.java   
@Length(min=0, max=11, message="rev_长度必须介于 0 和 11 之间")
public String getRev() {
    return rev;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiActinst.java   
@Length(min=0, max=255, message="act_name_长度必须介于 0 和 255 之间")
public String getActName() {
    return actName;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuVariable.java   
@Length(min=1, max=255, message="name_长度必须介于 1 和 255 之间")
public String getName() {
    return name;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiTaskinst.java   
@Length(min=0, max=64, message="proc_inst_id_长度必须介于 0 和 64 之间")
public String getProcInstId() {
    return procInstId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiTaskinst.java   
@Length(min=0, max=64, message="execution_id_长度必须介于 0 和 64 之间")
public String getExecutionId() {
    return executionId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuVariable.java   
@Length(min=0, max=64, message="task_id_长度必须介于 0 和 64 之间")
public String getTaskId() {
    return taskId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuVariable.java   
@Length(min=0, max=64, message="bytearray_id_长度必须介于 0 和 64 之间")
public String getBytearrayId() {
    return bytearrayId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuVariable.java   
@Length(min=0, max=4000, message="text_长度必须介于 0 和 4000 之间")
public String getText() {
    return text;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuVariable.java   
@Length(min=0, max=4000, message="text2_长度必须介于 0 和 4000 之间")
public String getText2() {
    return text2;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=11, message="rev_长度必须介于 0 和 11 之间")
public String getRev() {
    return rev;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=1, max=255, message="type_长度必须介于 1 和 255 之间")
public String getType() {
    return type;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=255, message="lock_owner_长度必须介于 0 和 255 之间")
public String getLockOwner() {
    return lockOwner;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiTaskinst.java   
@Length(min=0, max=255, message="category_长度必须介于 0 和 255 之间")
public String getCategory() {
    return category;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=64, message="process_instance_id_长度必须介于 0 和 64 之间")
public String getProcessInstanceId() {
    return processInstanceId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiVarinst.java   
@Length(min=0, max=64, message="proc_inst_id_长度必须介于 0 和 64 之间")
public String getProcInstId() {
    return procInstId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=11, message="retries_长度必须介于 0 和 11 之间")
public String getRetries() {
    return retries;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=64, message="exception_stack_id_长度必须介于 0 和 64 之间")
public String getExceptionStackId() {
    return exceptionStackId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=4000, message="exception_msg_长度必须介于 0 和 4000 之间")
public String getExceptionMsg() {
    return exceptionMsg;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=255, message="repeat_长度必须介于 0 和 255 之间")
public String getRepeat() {
    return repeat;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=255, message="handler_type_长度必须介于 0 和 255 之间")
public String getHandlerType() {
    return handlerType;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=4000, message="handler_cfg_长度必须介于 0 和 4000 之间")
public String getHandlerCfg() {
    return handlerCfg;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActRuJob.java   
@Length(min=0, max=255, message="tenant_id_长度必须介于 0 和 255 之间")
public String getTenantId() {
    return tenantId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiDetail.java   
@Length(min=0, max=64, message="proc_inst_id_长度必须介于 0 和 64 之间")
public String getProcInstId() {
    return procInstId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiDetail.java   
@Length(min=0, max=64, message="execution_id_长度必须介于 0 和 64 之间")
public String getExecutionId() {
    return executionId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiDetail.java   
@Length(min=0, max=64, message="task_id_长度必须介于 0 和 64 之间")
public String getTaskId() {
    return taskId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiDetail.java   
@Length(min=0, max=64, message="act_inst_id_长度必须介于 0 和 64 之间")
public String getActInstId() {
    return actInstId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiDetail.java   
@Length(min=1, max=255, message="name_长度必须介于 1 和 255 之间")
public String getName() {
    return name;
}
项目:ponto-inteligente-api    文件:CadastroPFDto.java   
@NotEmpty(message = "Nome não pode ser vazio.")
@Length(min = 3, max = 200, message = "Nome deve conter entre 3 e 200 caracteres.")
public String getNome() {
    return nome;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiDetail.java   
@Length(min=0, max=11, message="rev_长度必须介于 0 和 11 之间")
public String getRev() {
    return rev;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiDetail.java   
@Length(min=0, max=64, message="bytearray_id_长度必须介于 0 和 64 之间")
public String getBytearrayId() {
    return bytearrayId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiIdentitylink.java   
@Length(min=0, max=64, message="proc_inst_id_长度必须介于 0 和 64 之间")
public String getProcInstId() {
    return procInstId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiActinst.java   
@Length(min=0, max=255, message="tenant_id_长度必须介于 0 和 255 之间")
public String getTenantId() {
    return tenantId;
}
项目:ActivitiOrFlowableProcessInstanceCloneSolution    文件:ActHiTaskinst.java   
@Length(min=0, max=64, message="parent_task_id_长度必须介于 0 和 64 之间")
public String getParentTaskId() {
    return parentTaskId;
}