Class ECNumberValidator
java.lang.Object
org.apache.commons.validator.routines.ECNumberValidator
- All Implemented Interfaces:
Serializable
EC number validation.
The European Community number (EC number) is a unique seven-digit identifier that is assigned to chemical substances. For example, the EC number of arsenic is 231-148-6:
Check digit calculation is based on modulus 11 with digits being weighted based on their position (from left to right).
For further information see Wikipedia - EC number.
- Since:
- 1.9.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ECNumberValidatorGets the singleton instance of this validator.booleanTests whether the code is a valid EC number.Checks the code is valid EC number.
-
Method Details
-
getInstance
Gets the singleton instance of this validator.- Returns:
- A singleton instance of the EC Number validator.
-
isValid
Tests whether the code is a valid EC number.- Parameters:
code- The code to validate.- Returns:
trueif a EC number, otherwisefalse.
-
validate
Checks the code is valid EC number.- Parameters:
code- The code to validate.- Returns:
- An EC number code with dashes removed if valid, otherwise
null.
-