commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/map PredicatedMap.java
Date Fri, 07 May 2004 23:11:04 GMT
scolebourne    2004/05/07 16:11:04

  Modified:    collections/src/java/org/apache/commons/collections/map
                        PredicatedMap.java
  Log:
  Move validate method next to its comment
  
  Revision  Changes    Path
  1.11      +16 -17    jakarta-commons/collections/src/java/org/apache/commons/collections/map/PredicatedMap.java
  
  Index: PredicatedMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/map/PredicatedMap.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PredicatedMap.java	3 May 2004 21:48:49 -0000	1.10
  +++ PredicatedMap.java	7 May 2004 23:11:04 -0000	1.11
  @@ -89,22 +89,6 @@
           }
       }
   
  -    /**
  -     * Validates a key value pair.
  -     * 
  -     * @param key  the key to validate
  -     * @param value  the value to validate
  -     * @throws IllegalArgumentException if invalid
  -     */
  -    protected void validate(Object key, Object value) {
  -        if (keyPredicate != null && keyPredicate.evaluate(key) == false) {
  -            throw new IllegalArgumentException("Cannot add key - Predicate rejected it");
  -        }
  -        if (valuePredicate != null && valuePredicate.evaluate(value) == false)
{
  -            throw new IllegalArgumentException("Cannot add value - Predicate rejected it");
  -        }
  -    }
  -
       //-----------------------------------------------------------------------
       /**
        * Write the map out using a custom routine.
  @@ -135,6 +119,21 @@
       // The validate method exists for backwards compatability - in an ideal
       // world, it wouldn't and the superclass methods checkPutKey/checkPutValue
       // would be overridden instead
  +    /**
  +     * Validates a key value pair.
  +     * 
  +     * @param key  the key to validate
  +     * @param value  the value to validate
  +     * @throws IllegalArgumentException if invalid
  +     */
  +    protected void validate(Object key, Object value) {
  +        if (keyPredicate != null && keyPredicate.evaluate(key) == false) {
  +            throw new IllegalArgumentException("Cannot add key - Predicate rejected it");
  +        }
  +        if (valuePredicate != null && valuePredicate.evaluate(value) == false)
{
  +            throw new IllegalArgumentException("Cannot add value - Predicate rejected it");
  +        }
  +    }
   
       /**
        * Override to validate an object set into the map via <code>setValue</code>.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message