Coverage Report - org.mule.transport.email.filters.AbstractMailFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractMailFilter
0%
0/8
0%
0/4
3.5
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.email.filters;
 8  
 
 9  
 import org.mule.api.MuleMessage;
 10  
 import org.mule.api.routing.filter.Filter;
 11  
 import org.mule.util.ClassUtils;
 12  
 
 13  
 import javax.mail.Message;
 14  
 
 15  
 import org.apache.commons.logging.Log;
 16  
 import org.apache.commons.logging.LogFactory;
 17  
 
 18  
 /**
 19  
  * <code>AbstractMailFilter</code> is a base class for all javax.mail.Message
 20  
  * filters.
 21  
  */
 22  0
 public abstract class AbstractMailFilter implements Filter
 23  
 {
 24  
     /**
 25  
      * logger used by this class
 26  
      */
 27  0
     protected transient Log logger = LogFactory.getLog(getClass());
 28  
 
 29  
     public final boolean accept(MuleMessage message)
 30  
     {
 31  0
         if (message == null)
 32  
         {
 33  0
             return false;
 34  
         }
 35  
 
 36  0
         Object object = message.getPayload();
 37  0
         if (object instanceof Message)
 38  
         {
 39  0
             return accept((Message)object);
 40  
         }
 41  
         else
 42  
         {
 43  0
             throw new IllegalArgumentException("The Mail filter does not understand: "
 44  
                                                + ClassUtils.getSimpleName(object.getClass()));
 45  
         }
 46  
     }
 47  
 
 48  
     public abstract boolean accept(Message message);
 49  
 }