1 /* 2 * $Id: AnnotationsParserFactory.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.config; 11 12 import org.mule.api.EndpointAnnotationParser; 13 import org.mule.api.MessageProcessorAnnotationParser; 14 import org.mule.api.expression.ExpressionAnnotationParser; 15 16 import java.lang.annotation.Annotation; 17 import java.lang.reflect.Member; 18 19 /** 20 * Defines a common interface to find all Endpoint annotation parsers for a context. Endpoint parsers may be 21 * customized depending on the underlying platform. 22 * This is not an interface that users should ever need to use or customize, but Mule on different platforms 23 * can customize how the endpoints are created from the annotations. 24 * <p/> 25 * There are 3 types of annotation parser - 26 * 1. Endpoint : translates into an endpoint configured on a service object. 27 * 2. Router : translates into a router that will be configured on a service object, i.e. WireTap, Splitter, or Filter 28 * 3. Expression : translates into an expression, usually these are configured on method parameters so that an expression 29 * will get evaluated on the parameter before being passed into the method. 30 * 31 * @since 3.0 32 * 33 */ 34 public interface AnnotationsParserFactory 35 { 36 /** 37 * Retrieves a parser for the given annotation, the parameters passed in can be used to validate the use of 38 * the annotation, i.e. you may want to restrict annotations to only be configured on concrete classes 39 * 40 * @param annotation the annotation being processed 41 * @param aClass the class on which the annotation is defined 42 * @param member the class member on which the annotation was defined, such as Field, Method, Constructor, or 43 * null if a Type-level annotation. 44 * @return the endpoint annotation parser that can parse the supplied annotation or null if a matching parser 45 * not found 46 */ 47 EndpointAnnotationParser getEndpointParser(Annotation annotation, Class<?> aClass, Member member); 48 49 /** 50 * Retrieves a parser for the given annotation, where the annotation is an Expression annotation; one annotated with 51 * the {@link org.mule.api.annotations.meta.Evaluator} annotation. 52 * <p/> 53 * 54 * @param annotation the annotation being processed 55 * @return the expression annotation parser that can parse the supplied annotation or null if a matching parser 56 * not found 57 */ 58 ExpressionAnnotationParser getExpressionParser(Annotation annotation); 59 60 /** 61 * Retrieves a parser for the given annotation, where the annotation is a Router annotation; one annotated with 62 * the {@link org.mule.api.annotations.meta.Router} annotation. the parameters passed in can be used to validate the use of 63 * the annotation, i.e. you may want to restrict annotations to only be configured on concrete classes. 64 * <p/> 65 * 66 * @param annotation the annotation being processed 67 * @param aClass the class on which the annotation is defined 68 * @param member the class member on which the annotation was defined, such as Field, Method, Constructor, or 69 * null if a Type-level annotation. 70 * @return the router annotation parser that can parse the supplied annotation or null if a matching parser 71 * not found 72 */ 73 MessageProcessorAnnotationParser getRouterParser(Annotation annotation, Class<?> aClass, Member member); 74 75 }