Module gomint.api

Class StringValidator


  • public class StringValidator
    extends ParamValidator
    Version:
    1.0
    Author:
    geNAZt
    • Constructor Detail

      • StringValidator

        public StringValidator​(String regex)
    • Method Detail

      • validate

        public Object validate​(String input,
                               CommandSender commandSender)
        Validates given input
        Specified by:
        validate in class ParamValidator
        Parameters:
        input - from the command
        commandSender - which submitted the command
        Returns:
        non null object of validation on success (string for example) or null when validation failed
      • consume

        public String consume​(Iterator<String> data)
        Consume all parts this validator needs as input from the command
        Specified by:
        consume in class ParamValidator
        Parameters:
        data - left from the command which can be consumed
        Returns:
        the concatenated data consumed
      • hasValues

        public boolean hasValues()
        Does this validator have values which should be sent with the command. This is mostly used by enum params which define a set of values for selection.
        Specified by:
        hasValues in class ParamValidator
        Returns:
        true when there is data to be sent with this parameter, false when not
      • getHelpText

        public String getHelpText()
        Get a proper help text for the console output
        Overrides:
        getHelpText in class ParamValidator
        Returns:
        help text for the console