Coverage Report - org.mule.config.converters.FilterConverter
 
Classes in this File Line Coverage Branch Coverage Complexity
FilterConverter
0%
0/9
0%
0/2
2
 
 1  
 /*
 2  
  * $Id: FilterConverter.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  
 package org.mule.config.converters;
 11  
 
 12  
 import org.mule.api.MuleContext;
 13  
 import org.mule.api.expression.PropertyConverter;
 14  
 import org.mule.api.routing.filter.Filter;
 15  
 import org.mule.expression.ExpressionConfig;
 16  
 import org.mule.routing.filters.ExpressionFilter;
 17  
 
 18  
 /**
 19  
  * Converts an Expression sting into a Filter object. The string must define an expression that results in a
 20  
  * boolean value.
 21  
  */
 22  0
 public class FilterConverter implements PropertyConverter
 23  
 {
 24  
     public Object convert(String property, MuleContext context)
 25  
     {
 26  0
         if (null != property)
 27  
         {
 28  0
             ExpressionConfig config = new ExpressionConfig();
 29  0
             config.parse(property);
 30  0
             ExpressionFilter filter = new ExpressionFilter(config.getExpression(), config.getEvaluator(), config.getCustomEvaluator());
 31  0
             filter.setMuleContext(context);
 32  0
             return filter;
 33  
         }
 34  
         else
 35  
         {
 36  0
             return null;
 37  
         }
 38  
 
 39  
     }
 40  
 
 41  
     public Class getType()
 42  
     {
 43  0
         return Filter.class;
 44  
     }
 45  
 }