com.itextpdf.text.zugferd.checkers
Class CodeValidation

java.lang.Object
  extended by 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 Summary
CodeValidation()
           
 
Method Summary
 String check(String code)
          Checks if a specific code is valid.
 boolean isLowercase(String code, int chars)
          Checks the length of a code and if a code consists of lowercase letters from a to z.
 boolean isNumeric(String code, int digits)
          Checks the length of a code and if a code consists of numbers only.
 boolean isUppercase(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(String code)
          Checks if a specific code is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeValidation

public CodeValidation()
Method Detail

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


Copyright © 2015. All Rights Reserved.