You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by co...@apache.org on 2001/12/21 17:36:11 UTC

cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/cache/validator AndValidator.java

colus       01/12/21 08:36:11

  Added:       src/scratchpad/org/apache/avalon/excalibur/cache/validator
                        AndValidator.java
  Log:
  Added AndValidator.
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/cache/validator/AndValidator.java
  
  Index: AndValidator.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.excalibur.cache.validator;
  
  import org.apache.avalon.excalibur.cache.CacheValidator;
  
  /**
   * @author <a href="mailto:colus@isoft.co.kr">Eung-ju Park</a>
   */
  public class AndValidator
      implements CacheValidator
  {
      private CacheValidator[] m_validators;
  
      public AndValidator( final CacheValidator validator1,
                           final CacheValidator validator2 )
      {
          m_validators = new CacheValidator[ 2 ];
          m_validators[ 0 ] = validator1;
          m_validators[ 1 ] = validator2;
      }
  
      public AndValidator( final CacheValidator[] validators )
      {
          m_validators = validators;
      }
  
      public boolean validate( final Object key, final Object value )
      {
          for ( int i = 0; i < m_validators.length; i++ )
          {
              if ( ! m_validators[ i ].validate( key, value ) )
              {
                  return false;
              }
          }
  
          return true;
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Jylog

Posted by Mircea Toma <mi...@home.com>.
check out:

http://www.javaworld.com/javaworld/jw-12-2001/jw-1214-jylog_p.html


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>