Spring Framework
  1. Spring Framework
  2. SPR-9828

Modify org.springframework.util.Assert.* methods so that they will return checked values

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1.2
    • Fix Version/s: Waiting for Triage
    • Component/s: Core
    • Labels:
      None

      Description

      The proposed improvement is to modify signature for each org.springframework.util.Assert.* method so that it will return the checked value to let programmer to make check and assignment in "one turn".

      This would improve readability of the initializers that uses spring's Assert and minimize the code, e.g. instead of having to write

      notNull(foo, "Foo can't be null"); // static import omitted for clarity
      hasText(bar, "Bar can't be empty");
      this.foo = foo;
      this.bar = bar;

      someone can write

      this.foo = notNull(foo, "Foo can't be null");
      this.bar = hasText(bar, "Bar can't be empty");

        Activity

        Hide
        Alexander Shabanov added a comment -

        I'd gladly commit the corresponding changes if you find the improvement appropriate for spring framework.
        Please let me know if you consider the improvement as positive one.

        Show
        Alexander Shabanov added a comment - I'd gladly commit the corresponding changes if you find the improvement appropriate for spring framework. Please let me know if you consider the improvement as positive one.

          People

          • Assignee:
            Chris Beams
            Reporter:
            Alexander Shabanov
            Last updater:
            Chris Beams
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Days since last comment:
              1 year, 29 weeks, 2 days ago