Coverage Report - org.mule.config.expression.ExprAnnotationParser
 
Classes in this File Line Coverage Branch Coverage Complexity
ExprAnnotationParser
0%
0/6
0%
0/2
0
 
 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.expression;
 8  
 
 9  
 import org.mule.api.annotations.expressions.Expr;
 10  
 import org.mule.api.annotations.meta.Evaluator;
 11  
 import org.mule.api.expression.ExpressionAnnotationParser;
 12  
 import org.mule.expression.ExpressionConfig;
 13  
 import org.mule.expression.transformers.ExpressionArgument;
 14  
 
 15  
 import java.lang.annotation.Annotation;
 16  
 
 17  
 /**
 18  
  * Used to parse Expr parameter annotations
 19  
  *
 20  
  * @see org.mule.expression.StringExpressionEvaluator
 21  
  * @see org.mule.api.annotations.expressions.Expr
 22  
  *
 23  
  * @since 3.0
 24  
  */
 25  0
 public class ExprAnnotationParser implements ExpressionAnnotationParser
 26  
 {
 27  
     public ExpressionArgument parse(Annotation annotation, Class<?> parameterType)
 28  
     {
 29  0
         Evaluator evaluator = annotation.annotationType().getAnnotation(Evaluator.class);
 30  0
         if (evaluator != null)
 31  
         {
 32  0
             return new ExpressionArgument(null, new ExpressionConfig(((Expr) annotation).value(),
 33  
                     evaluator.value(), null), ((Expr) annotation).optional(), parameterType);
 34  
         }
 35  
         else
 36  
         {
 37  0
             throw new IllegalArgumentException("The @Evaluator annotation must be set on an Expression Annotation");
 38  
         }
 39  
 
 40  
     }
 41  
 
 42  
     public boolean supports(Annotation annotation)
 43  
     {
 44  0
         return annotation instanceof Expr;
 45  
     }
 46  
 }