Coverage Report - org.mule.routing.filters.PayloadTypeFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
PayloadTypeFilter
100%
9/9
100%
2/2
1
 
 1  
 /*
 2  
  * $Id: PayloadTypeFilter.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.umo.UMOFilter;
 14  
 import org.mule.umo.UMOMessage;
 15  
 
 16  
 /**
 17  
  * <code>PayloadTypeFilter</code> filters based on the type of the object received.
 18  
  */
 19  
 
 20  
 public class PayloadTypeFilter implements UMOFilter
 21  
 {
 22  
     private Class expectedType;
 23  
 
 24  
     public PayloadTypeFilter()
 25  
     {
 26  6
         super();
 27  6
     }
 28  
 
 29  
     public PayloadTypeFilter(Class expectedType)
 30  38
     {
 31  38
         this.expectedType = expectedType;
 32  38
     }
 33  
 
 34  
     public boolean accept(UMOMessage message)
 35  
     {
 36  114
         return (expectedType != null ? expectedType.isAssignableFrom(message.getPayload().getClass()) : false);
 37  
     }
 38  
 
 39  
     public Class getExpectedType()
 40  
     {
 41  18
         return expectedType;
 42  
     }
 43  
 
 44  
     public void setExpectedType(Class expectedType)
 45  
     {
 46  8
         this.expectedType = expectedType;
 47  8
     }
 48  
 
 49  
 }