Coverage Report - org.mule.module.scripting.config.GroovyAnnotationParser
 
Classes in this File Line Coverage Branch Coverage Complexity
GroovyAnnotationParser
0%
0/6
0%
0/2
0
 
 1  
 /*
 2  
  * $Id: GroovyAnnotationParser.java 20321 2010-11-24 15:21:24Z dfeist $
 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.module.scripting.config;
 11  
 
 12  
 import org.mule.api.annotations.expression.Groovy;
 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  0
 public class GroovyAnnotationParser implements ExpressionAnnotationParser
 22  
 {
 23  
     public ExpressionArgument parse(Annotation annotation, Class<?> parameterType)
 24  
     {
 25  0
         Evaluator evaluator = annotation.annotationType().getAnnotation(Evaluator.class);
 26  0
         if (evaluator != null)
 27  
         {
 28  0
             return new ExpressionArgument(null, new ExpressionConfig(((Groovy) annotation).value(),
 29  
                     evaluator.value(), null), ((Groovy) annotation).optional(), parameterType);
 30  
         }
 31  
         else
 32  
         {
 33  0
             throw new IllegalArgumentException("The @Evaluator annotation must be set on an Expression Annotation");
 34  
         }
 35  
     }
 36  
 
 37  
     public boolean supports(Annotation annotation)
 38  
     {
 39  0
         return annotation instanceof Groovy;
 40  
     }
 41  
 }