Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-579

Add new Validate methods

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0
    • 3.0
    • lang.*
    • None
    • Java SE 5.0+

    Description

      Expand Validate to include more specific, human readable validation for commonly validated parameter values (so isTrue() isn't needed as often). Include new Validate methods:

      matchesPattern(String string, String pattern)
      throws an IllegalArgumentException stating ("The string " + string + " does not match the pattern " + pattern) when the provided string does not match the regular expression pattern.

      matchesPattern(String string, String pattern, String message)
      throws an IllegalArgumentException stating (message + string) when the provided string does not match the regular expression pattern.

      matchesPattern(String string, Pattern pattern)
      throws an IllegalArgumentException stating ("The string " + string + " does not match the pattern " + pattern) when the provided string does not match the regular expression pattern.

      matchesPattern(String string, Pattern pattern, String message)
      throws an IllegalArgumentException stating (message + string) when the provided string does not match the regular expression pattern.

      inclusiveBetween(Comparable<T> start, Comparable<T> end, Comparable<T> value)
      throws an IllegalArgumentException stating ("The value " + value + " is not in the specified inclusive range of " + start + " to " + end) when the provided value does not fall between the two comparable values (inclusive).

      inclusiveBetween(Comparable<T> start, Comparable<T> end, Comparable<T> value, String message)
      throws an IllegalArgumentException stating (message + value) when the provided value does not fall between the two comparable values (inclusive).

      exclusiveBetween(Comparable<T> start, Comparable<T> end, Comparable<T> value)
      throws an IllegalArgumentException stating ("The value " + value + " is not in the specified exclusive range of " + start + " to " + end) when the provided value does not fall between the two comparable values (exclusive).

      exclusiveBetween(Comparable<T> start, Comparable<T> end, Comparable<T> value, String message)
      throws an IllegalArgumentException stating (message + value) when the provided value does not fall between the two comparable values (exclusive).

      Attachments

        1. LANG_579.diff
          10 kB
          Valentin Rocher

        Activity

          People

            Unassigned Unassigned
            mwooten.dev Michael Wooten
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 96h
                96h
                Remaining:
                Remaining Estimate - 96h
                96h
                Logged:
                Time Spent - Not Specified
                Not Specified