Java 类org.hibernate.validator.constraints.br.CPF 实例源码

项目:gwt-bean-validators    文件:CPFValidator.java   
@Override
public void initialize(final CPF constraintAnnotation) {
  // validates CPF strings with separator, eg 134.241.313-00
  // there are two checksums generated. The first over the digits prior the hyphen with the first
  // check digit being the digit directly after the hyphen. The second checksum is over all digits
  // pre hyphen + first check digit. The check digit in this case is the second digit after the
  // hyphen
  this.withSeparatorMod11Validator1.initialize(0, 10, 12, true, Integer.MAX_VALUE, '0', '0',
      Mod11Check.ProcessingDirection.RIGHT_TO_LEFT);
  this.withSeparatorMod11Validator2.initialize(0, 12, 13, true, Integer.MAX_VALUE, '0', '0',
      Mod11Check.ProcessingDirection.RIGHT_TO_LEFT);

  // validates CPF strings with separator, eg 134241313-00
  this.withDashOnlySeparatorMod11Validator1.initialize(0, 8, 10, true, Integer.MAX_VALUE, '0',
      '0', Mod11Check.ProcessingDirection.RIGHT_TO_LEFT);
  this.withDashOnlySeparatorMod11Validator2.initialize(0, 10, 11, true, Integer.MAX_VALUE, '0',
      '0', Mod11Check.ProcessingDirection.RIGHT_TO_LEFT);

  // validates CPF strings without separator, eg 13424131300
  // checksums as described above, except there are no separator characters
  this.withoutSeparatorMod11Validator1.initialize(0, 8, 9, true, Integer.MAX_VALUE, '0', '0',
      Mod11Check.ProcessingDirection.RIGHT_TO_LEFT);
  this.withoutSeparatorMod11Validator2.initialize(0, 9, 10, true, Integer.MAX_VALUE, '0', '0',
      Mod11Check.ProcessingDirection.RIGHT_TO_LEFT);
}
项目:ponto-inteligente-api    文件:CadastroPFDto.java   
@NotEmpty(message = "CPF não pode ser vazio.")
@CPF(message="CPF inválido")
public String getCpf() {
    return cpf;
}
项目:ponto-inteligente-api    文件:CadastroPJDto.java   
@NotEmpty(message = "CPF não pode ser vazio.")
@CPF(message="CPF inválido")
public String getCpf() {
    return cpf;
}