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
Abstract superclass of a series of code validation classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionChecks if a specific code is valid.booleanisLowercase(String code, int chars) Checks the length of a code and if a code consists of lowercase letters from a to z.booleanChecks the length of a code and if a code consists of numbers only.booleanisUppercase(String code, int chars) Checks the length of a code and if a code consists of uppercase letters from A to Z.abstract booleanChecks if a specific code is valid.
-
Constructor Details
-
CodeValidation
public CodeValidation()
-
-
Method Details
-
isValid
Checks if a specific code is valid.- Parameters:
code- the value you want to check- Returns:
- true if the code is valid
-
check
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
Checks the length of a code and if a code consists of numbers only.- Parameters:
code- the code that needs to be checkeddigits- the expected length of the code- Returns:
- true if the code is numeric and has the expected length
-
isUppercase
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 checkedchars- the expected length of the code- Returns:
- true if the code consists of letters from A to Z and has the expected length
-
isLowercase
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 checkedchars- the expected length of the code- Returns:
- true if the code consists of letters from a to z and has the expected length
-