commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1766163 - /commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java
Date Fri, 21 Oct 2016 21:49:43 GMT
Author: mbenson
Date: Fri Oct 21 21:49:43 2016
New Revision: 1766163

URL: http://svn.apache.org/viewvc?rev=1766163&view=rev
Log:
readability, javadoc, encapsulation

Modified:
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java?rev=1766163&r1=1766162&r2=1766163&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java
(original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java
Fri Oct 21 21:49:43 2016
@@ -118,7 +118,7 @@ public class EntityArray extends EntityC
             }
             throw new IllegalStateException("size already set");
         }
-        Validate.inclusiveBetween(minimumSize, maximumSize, size,
+        Validate.inclusiveBetween(getMinimumSize(), getMaximumSize(), size,
             "illegal collection size: %d; should be >= %d and >= %d", size, minimumSize,
maximumSize);
         this.size = size;
     }
@@ -200,9 +200,7 @@ public class EntityArray extends EntityC
      * @param maximumSize int
      */
     public synchronized void setMaximumSize(int maximumSize) {
-        if (maximumSize > Integer.MAX_VALUE || maximumSize < getMinimumSize()) {
-            throw new IllegalArgumentException(Integer.toString(maximumSize));
-        }
+        Validate.inclusiveBetween(getMinimumSize(), Integer.MAX_VALUE, maximumSize);
         this.maximumSize = maximumSize;
     }
 
@@ -219,14 +217,12 @@ public class EntityArray extends EntityC
      * @param minimumSize int
      */
     public synchronized void setMinimumSize(int minimumSize) {
-        if (minimumSize < 0 || minimumSize > getMaximumSize()) {
-            throw new IllegalArgumentException(Integer.toString(minimumSize));
-        }
+        Validate.inclusiveBetween(0, getMaximumSize(), minimumSize);
         this.minimumSize = minimumSize;
     }
 
     /**
-     * Get the boolean resizable.
+     * Learn whether this {@link EntityArray} is resizable.
      * @return boolean
      */
     public boolean isResizable() {
@@ -234,7 +230,7 @@ public class EntityArray extends EntityC
     }
 
     /**
-     * Set the boolean resizable.
+     * Set whether this {@link EntityArray} is resizable.
      * @param resizable boolean
      */
     public void setResizable(boolean resizable) {



Mime
View raw message