org.openmrs.patient.impl
Class LuhnIdentifierValidator
java.lang.Object
org.openmrs.patient.impl.BaseHyphenatedIdentifierValidator
org.openmrs.patient.impl.LuhnIdentifierValidator
- All Implemented Interfaces:
- IdentifierValidator
public class LuhnIdentifierValidator
- extends BaseHyphenatedIdentifierValidator
A IdentifierValidator based on the Regenstrief Institute's version of the Luhn Algorithm.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LuhnIdentifierValidator
public LuhnIdentifierValidator()
getCheckDigit
protected int getCheckDigit(java.lang.String undecoratedIdentifier)
- Specified by:
getCheckDigit
in class BaseHyphenatedIdentifierValidator
getName
public java.lang.String getName()
- Specified by:
getName
in interface IdentifierValidator
- Specified by:
getName
in class BaseHyphenatedIdentifierValidator
- Returns:
- The name of this validator. E.g. "Luhn Algorithm"
- See Also:
IdentifierValidator.getName()
getAllowedCharacters
public java.lang.String getAllowedCharacters()
- Specified by:
getAllowedCharacters
in interface IdentifierValidator
- Specified by:
getAllowedCharacters
in class BaseHyphenatedIdentifierValidator
- Returns:
- A string containing all the characters allowed in this type of identifier validation.
- See Also:
IdentifierValidator.getAllowedCharacters()
getValidIdentifier
public java.lang.String getValidIdentifier(java.lang.String undecoratedIdentifier)
throws UnallowedIdentifierException
- Specified by:
getValidIdentifier
in interface IdentifierValidator
- Overrides:
getValidIdentifier
in class BaseHyphenatedIdentifierValidator
- Parameters:
undecoratedIdentifier
- The identifier prior to being given a check digit or other form
of validation.
- Returns:
- The identifier after the check digit or other form of validation has been applied.
- Throws:
UnallowedIdentifierException
- if the identifier contains unallowed characters or is
otherwise not appropriate for this validator.- See Also:
IdentifierValidator.getValidIdentifier(java.lang.String)
- Expected behavior:
- get valid identifier, fail with invalid identifiers
Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change