Class CodeValidation

java.lang.Object
com.itextpdf.text.zugferd.checkers.CodeValidation
Direct Known Subclasses:
AdditionalReferencedDocumentsCode, AllowanceChargeReasonCode, CountryCode, CurrencyCode, DateFormatCode, DocumentTypeCode, FreeTextSubjectCode, GlobalIdentifierCode, IncotermsCode, LanguageCode, MeasurementUnitCode, NumberChecker, PaymentMeansCode, ProductClassificationSystemCode, QuantityCode, TaxCategoryCode, TaxIDTypeCode, TaxTypeCode, TransportIdentificationCode, TransportMeansCode

public abstract class CodeValidation extends Object
Abstract superclass of a series of code validation classes.
  • Constructor Details

    • CodeValidation

      public CodeValidation()
  • Method Details

    • isValid

      public abstract boolean isValid(String code)
      Checks if a specific code is valid.
      Parameters:
      code - the value you want to check
      Returns:
      true if the code is valid
    • check

      public String check(String code) throws InvalidCodeException
      Checks if a specific code is valid.
      Parameters:
      code - the value you want to check
      Returns:
      the code that has been checked
      Throws:
      InvalidCodeException - reveals the reason why the code isn't valid
    • isNumeric

      public boolean isNumeric(String code, int digits)
      Checks the length of a code and if a code consists of numbers only.
      Parameters:
      code - the code that needs to be checked
      digits - the expected length of the code
      Returns:
      true if the code is numeric and has the expected length
    • isUppercase

      public boolean isUppercase(String code, int chars)
      Checks the length of a code and if a code consists of uppercase letters from A to Z.
      Parameters:
      code - the code that needs to be checked
      chars - the expected length of the code
      Returns:
      true if the code consists of letters from A to Z and has the expected length
    • isLowercase

      public boolean isLowercase(String code, int chars)
      Checks the length of a code and if a code consists of lowercase letters from a to z.
      Parameters:
      code - the code that needs to be checked
      chars - the expected length of the code
      Returns:
      true if the code consists of letters from a to z and has the expected length