Class AbstractStringRestriction

    • Constructor Detail

      • AbstractStringRestriction

        public AbstractStringRestriction()
    • Method Detail

      • isValid

        protected abstract boolean isValid​(java.lang.String value)
        Method that derived classes must implement to check whether a value is valid
        Parameters:
        value - Value
        Returns:
        True if valid, false if valid
      • violated

        protected abstract <T> ParseRestrictionViolatedException violated​(ParseState<T> state,
                                                                          OptionMetadata option,
                                                                          java.lang.String value)
        Method that derived classes must implement to provide an exception for the case of an invalid option value, this will be called if isValid(String) returns false
        Parameters:
        state - Parser state
        option - Option metadata for the option whose value is being checked
        value - Value which has been deemed invalid
        Returns:
        Exception
      • violated

        protected abstract <T> ParseRestrictionViolatedException violated​(ParseState<T> state,
                                                                          ArgumentsMetadata arguments,
                                                                          java.lang.String value)
        Method that derived classes must implement to provide an exception for the case of an invalid argument value, this will be called if isValid(String) returns false
        Parameters:
        state - Parser state
        arguments - Arguments metadata
        value - Value which has been deemed invalid
        Returns:
        Exception