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  
  * 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.routing.filters;
 8  
 
 9  
 import org.mule.api.MuleMessage;
 10  
 import org.mule.api.routing.filter.Filter;
 11  
 import org.mule.api.routing.filter.ObjectFilter;
 12  
 
 13  
 /**
 14  
  * <code>EqualsFilter</code> is a filter for comparing two objects using the
 15  
  * equals() method.
 16  
  */
 17  
 public class EqualsFilter implements Filter, ObjectFilter
 18  
 {
 19  
     private Object pattern;
 20  
 
 21  
     public EqualsFilter()
 22  
     {
 23  0
         super();
 24  0
     }
 25  
 
 26  
     public EqualsFilter(Object compareTo)
 27  0
     {
 28  0
         this.pattern = compareTo;
 29  0
     }
 30  
 
 31  
     public boolean accept(MuleMessage message)
 32  
     {
 33  0
         return accept(message.getPayload());
 34  
     }
 35  
 
 36  
     public boolean accept(Object object)
 37  
     {
 38  0
         if (object == null && pattern == null)
 39  
         {
 40  0
             return true;
 41  
         }
 42  
 
 43  0
         if (object == null || pattern == null)
 44  
         {
 45  0
             return false;
 46  
         }
 47  
 
 48  0
         return pattern.equals(object);
 49  
     }
 50  
 
 51  
     public Object getPattern()
 52  
     {
 53  0
         return pattern;
 54  
     }
 55  
 
 56  
     public void setPattern(Object pattern)
 57  
     {
 58  0
         this.pattern = pattern;
 59  0
     }
 60  
 
 61  
 }