Class CheckDigitLuhn

  • All Implemented Interfaces:
    LTRandom, Comparable<LogicalType>

    public class CheckDigitLuhn
    extends CheckDigitLT
    Plugin to detect valid Luhn check digits (typically Credit Cards or IMEI Numbers).
    • Field Detail

      • SEMANTIC_TYPE

        public static final String SEMANTIC_TYPE
        The Semantic type for this Plugin.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CheckDigitLuhn

        public CheckDigitLuhn​(PluginDefinition plugin)
        Construct a plugin to detect Luhn Check Digits based on the Plugin Definition.
        Parameters:
        plugin - The definition of this plugin.
    • Method Detail

      • isValid

        public boolean isValid​(String input,
                               boolean detectMode,
                               long count)
        Description copied from class: LogicalType
        Is the supplied String an instance of this Semantic type?
        Overrides:
        isValid in class CheckDigitLT
        Parameters:
        input - String to check (trimmed for Numeric base Types, un-trimmed for String base Type)
        detectMode - If true then we are in the process of detection, otherwise it is a simple validity check.
        count - The number of instance of this sample.
        Returns:
        true iff the supplied String is an instance of this Semantic type.
      • getSemanticType

        public String getSemanticType()
        Description copied from class: LogicalType
        The name of the Semantic Type. For example, EMAIL for an email address.
        Overrides:
        getSemanticType in class LogicalType
        Returns:
        The name of the Semantic Type.
      • nextRandom

        public String nextRandom()
        Description copied from interface: LTRandom
        nextRandom will generate a random (secure) valid example of this Semantic Type.
        Specified by:
        nextRandom in interface LTRandom
        Overrides:
        nextRandom in class CheckDigitLT
        Returns:
        a new valid example of the Semantic Type.