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 java.lang.Object
Abstract superclass of a series of code validation classes.
-
-
Constructor Summary
Constructors Constructor Description CodeValidation()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
check(java.lang.String code)
Checks if a specific code is valid.boolean
isLowercase(java.lang.String code, int chars)
Checks the length of a code and if a code consists of lowercase letters from a to z.boolean
isNumeric(java.lang.String code, int digits)
Checks the length of a code and if a code consists of numbers only.boolean
isUppercase(java.lang.String code, int chars)
Checks the length of a code and if a code consists of uppercase letters from A to Z.abstract boolean
isValid(java.lang.String code)
Checks if a specific code is valid.
-
-
-
Method Detail
-
isValid
public abstract boolean isValid(java.lang.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 java.lang.String check(java.lang.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(java.lang.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 checkeddigits
- the expected length of the code- Returns:
- true if the code is numeric and has the expected length
-
isUppercase
public boolean isUppercase(java.lang.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 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
public boolean isLowercase(java.lang.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 checkedchars
- the expected length of the code- Returns:
- true if the code consists of letters from a to z and has the expected length
-
-