Package br.com.caelum.stella.format

Examples of br.com.caelum.stella.format.CPFFormatter


        errors.add(messageProducer.getMessage(CPFError.INVALID_FORMAT));
      }

      String unformatedCPF = null;
      try {
        unformatedCPF = new CPFFormatter().unformat(cpf);
      } catch (IllegalArgumentException e) {
        errors.add(messageProducer.getMessage(CPFError.INVALID_DIGITS));
        return errors;
      }
View Full Code Here


        errors.add(messageProducer.getMessage(CPFError.INVALID_FORMAT));
      }

      String unformatedCPF = null;
      try {
        unformatedCPF = new CPFFormatter().unformat(cpf);
      } catch (IllegalArgumentException e) {
        errors.add(messageProducer.getMessage(CPFError.INVALID_DIGITS));
        return errors;
      }
View Full Code Here

     * Caso contrário, ele guarda o parâmetro como passado em ambos os atributos.
     *
     * @param numero número do CPF
     */
    public CPF(String numero) {
      CPFFormatter formatador = new CPFFormatter();
    if (formatador.isFormatted(numero)) {
      this.numero = formatador.unformat(numero);
      this.numeroFormatado = numero;
    } else if (formatador.canBeFormatted(numero)) {
      this.numero = numero;
      this.numeroFormatado = formatador.format(numero);
    } else {
      this.numero = this.numeroFormatado = numero;
    }
    }
View Full Code Here

        String unformatedCPF = null;
        if (isFormatted) {
            if (!CPF_FORMATED.matcher(string).matches()) {
                errors.add(CPFError.INVALID_FORMAT);
            }
            unformatedCPF = (new CPFFormatter()).unformat(string);
        } else {
            if (!(CPF_UNFORMATED.matcher(string).matches())) {
                errors.add(CPFError.INVALID_DIGITS);
            }
            unformatedCPF = string;
View Full Code Here

    private Formatter formatter;

    @Before
    public void before() {
        formatter = new CPFFormatter();
    }
View Full Code Here

                    errors.add(CPFError.INVALID_DIGITS);
                }
            } else {
                String unformatedCPF;
                if (isFormatted) {
                    CPFFormatter formatter = new CPFFormatter();
                    unformatedCPF = formatter.unformat(cpf);
                } else {
                    unformatedCPF = cpf;
                }
                if (errors.isEmpty()) {
                    if ((!isIgnoringRepeatedDigits) && hasAllRepeatedDigits(unformatedCPF)) {
View Full Code Here

                    errors.add(CPFError.INVALID_DIGITS);
                }
            } else {
                String unformatedCPF;
                if (isFormatted) {
                    CPFFormatter formatter = new CPFFormatter();
                    unformatedCPF = formatter.unformat(cpf);
                } else {
                    unformatedCPF = cpf;
                }
                if (errors.isEmpty()) {
                    if ((!isIgnoringRepeatedDigits) && hasAllRepeatedDigits(unformatedCPF)) {
View Full Code Here

                    errors.add(CPFError.INVALID_DIGITS);
                }
            } else {
                String unformatedCPF;
                if (isFormatted) {
                    CPFFormatter formatter = new CPFFormatter();
                    unformatedCPF = formatter.unformat(cpf);
                } else {
                    unformatedCPF = cpf;
                }
                if (errors.isEmpty()) {
                    if ((!isIgnoringRepeatedDigits) && hasAllRepeatedDigits(unformatedCPF)) {
View Full Code Here

TOP

Related Classes of br.com.caelum.stella.format.CPFFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.