Class ECIndexNumberValidator

java.lang.Object
org.apache.commons.validator.routines.ECIndexNumberValidator
All Implemented Interfaces:
Serializable

public final class ECIndexNumberValidator extends Object implements Serializable
EC index number validation.

The European Community index number is a unique nine-digit identifier that is assigned to hazardous chemical substances.
For example, the EC index number of lithium is 003-001-00-4

The Index number for each substance is in the form of a digit sequence of the type ABC-RST-VW-Y.
ABC corresponds to the atomic number of the most characteristic element or the most characteristic organic group in the molecule.
RST is the consecutive number of the substance in the series ABC.
VW denotes the form in which the substance is produced or placed on the market.
Y is the check-digit. Check digit calculation is based on modulus 11 with digits being weighted based on their position (from left to right).

For further information see CLP_Regulation - ANNEX VI 1.1.1.1.Index numbers

Since:
1.9.0
See Also:
  • Method Details

    • getInstance

      public static ECIndexNumberValidator getInstance()
      Gets the singleton instance of this validator.
      Returns:
      A singleton instance of the EC Index Number validator.
    • isValid

      public boolean isValid(String code)
      Tests whether the code is a valid EC index number.
      Parameters:
      code - The code to validate.
      Returns:
      true if a EC index number, otherwise false.
    • validate

      public Object validate(String code)
      Checks the code is valid EC index number.
      Parameters:
      code - The code to validate.
      Returns:
      An EC index number code with dashes removed if valid, otherwise null.