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