Class CASNumberValidator
java.lang.Object
org.apache.commons.validator.routines.CASNumberValidator
- All Implemented Interfaces:
Serializable
CAS Registry Number (or Chemical Abstracts Service (CAS RN)) validation.
CAS Numbers are unique identification numbers used to identify chemical substance described in the open scientific literature.
Check digit calculation is based on modulus 10 with digits being weighted based on their position (from right to left).
For further information see Wikipedia - CAS Registry Number.
- Since:
- 1.9.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic CASNumberValidatorGets the singleton instance of this validator.booleanTests whether the code is a valid CAS number.Checks the code is valid CAS number.
-
Method Details
-
getInstance
Gets the singleton instance of this validator.- Returns:
- A singleton instance of the CAS Number validator.
-
isValid
Tests whether the code is a valid CAS number.- Parameters:
code- The code to validate.- Returns:
trueif a CAS number, otherwisefalse.
-
validate
Checks the code is valid CAS number.- Parameters:
code- The code to validate.- Returns:
- A CAS number code with dashes removed if valid, otherwise
null.
-