Coverage Report - org.mule.routing.filters.EqualsFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
EqualsFilter
0%
0/14
0%
0/8
1.667
 
 1  
 /*
 2  
  * $Id: EqualsFilter.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.routing.filters;
 12  
 
 13  
 import org.mule.api.MuleMessage;
 14  
 import org.mule.api.routing.filter.Filter;
 15  
 import org.mule.api.routing.filter.ObjectFilter;
 16  
 
 17  
 /**
 18  
  * <code>EqualsFilter</code> is a filter for comparing two objects using the
 19  
  * equals() method.
 20  
  */
 21  
 public class EqualsFilter implements Filter, ObjectFilter
 22  
 {
 23  
     private Object pattern;
 24  
 
 25  
     public EqualsFilter()
 26  
     {
 27  0
         super();
 28  0
     }
 29  
 
 30  
     public EqualsFilter(Object compareTo)
 31  0
     {
 32  0
         this.pattern = compareTo;
 33  0
     }
 34  
 
 35  
     public boolean accept(MuleMessage message)
 36  
     {
 37  0
         return accept(message.getPayload());
 38  
     }
 39  
 
 40  
     public boolean accept(Object object)
 41  
     {
 42  0
         if (object == null && pattern == null)
 43  
         {
 44  0
             return true;
 45  
         }
 46  
 
 47  0
         if (object == null || pattern == null)
 48  
         {
 49  0
             return false;
 50  
         }
 51  
 
 52  0
         return pattern.equals(object);
 53  
     }
 54  
 
 55  
     public Object getPattern()
 56  
     {
 57  0
         return pattern;
 58  
     }
 59  
 
 60  
     public void setPattern(Object pattern)
 61  
     {
 62  0
         this.pattern = pattern;
 63  0
     }
 64  
 
 65  
 }