Class ECNumberValidator

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

public final class ECNumberValidator extends Object implements 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 Details

    • getInstance

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

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

      public Object validate(String code)
      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.