Package br.com.caelum.stella.validation

Examples of br.com.caelum.stella.validation.CNPJValidator


  /**
   * @see org.hibernate.validator.Validator#initialize(java.lang.annotation.Annotation)
   */
  public void initialize(CNPJ cnpj) {
    AnnotationMessageProducer messageProducer = new AnnotationMessageProducer(cnpj);
    stellaValidator = new CNPJValidator(messageProducer, cnpj.formatted());
  }
View Full Code Here


    public static void main(String[] args) {
        String cnpj = "26.637.142/0001-48";
        ResourceBundle resourceBundle = ResourceBundle.getBundle("StellaValidationMessages", new Locale("pt", "BR"));
        MessageProducer messageProducer = new ResourceBundleMessageProducer(resourceBundle);
        boolean isFormatted = true;
        CNPJValidator validator = new CNPJValidator(messageProducer, isFormatted);
        try {
            // lógica de negócio ...
            validator.assertValid(cnpj);
            // continuação da lógica de negócio ...
        } catch (InvalidStateException e) {
            for (ValidationMessage message : e.getInvalidMessages()) {
                System.out.println(message.getMessage());
            }
View Full Code Here

TOP

Related Classes of br.com.caelum.stella.validation.CNPJValidator

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.