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