Class VesselIMOValidator

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

public final class VesselIMOValidator extends Object implements Serializable
Vessel IMO Number validation.

IMO Numbers are unique identification numbers used to identify vessels.

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 - IMO Number.

Since:
1.9.0
See Also:
  • Method Details

    • getInstance

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

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

      public Object validate(String code)
      Checks the code is valid IMO number.
      Parameters:
      code - The code to validate.
      Returns:
      A IMO number code with prefix removed if valid, otherwise null.