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.api; 8 9 import org.mule.api.endpoint.InboundEndpoint; 10 import org.mule.api.endpoint.OutboundEndpoint; 11 12 import java.lang.annotation.Annotation; 13 import java.lang.reflect.Member; 14 import java.util.Map; 15 16 /** 17 * An SPI interface that will process an Endpoint annotation. Note that the 18 * Annotation must be annotated with the <code>@Endpoint</code> annotation. 19 */ 20 public interface EndpointAnnotationParser 21 { 22 /** 23 * Creates an outbound endpoint from the annotation. 24 * 25 * @param annotation the annotation to process 26 * @param metaInfo any additional info that can be used to construct the endpoint. Typically a connector name might be 27 * in this map so that all endpoints for the current object can share the same connector 28 * @return a new {@link org.mule.api.endpoint.OutboundEndpoint} object configured according to the annotation 29 * @throws MuleException if the outbound endpoint cannot be created. A Mule-specific error will be thrown. 30 */ 31 public OutboundEndpoint parseOutboundEndpoint(Annotation annotation, Map metaInfo) throws MuleException; 32 33 /** 34 * Creates an inbound endpoint from the annotation. 35 * 36 * @param annotation the annotation to process 37 * @param metaInfo any additional info that can be used to construct the endpoint. Typically a connector name might be 38 * in this map so that all endpoints for the current object can share the same connector 39 * @return a new {@link org.mule.api.endpoint.InboundEndpoint} object configured according to the annotation 40 * @throws MuleException if the inbound endpoint cannot be created. A Mule-specific error will be thrown. 41 */ 42 public InboundEndpoint parseInboundEndpoint(Annotation annotation, Map metaInfo) throws MuleException; 43 44 /** 45 * Determines whether this parser can process the current annotation. The clazz and member params are passed in 46 * so that further validation be done on the location, type or name of these elements. 47 * 48 * @param annotation the annotation being processed 49 * @param clazz the class on which the annotation was found 50 * @param member the member on which the annotation was found inside the class. This is only set when the annotation 51 * was either set on a {@link java.lang.reflect.Method}, {@link java.lang.reflect.Field} or {@link java.lang.reflect.Constructor} 52 * class member, otherwise this value is null. 53 * @return true if this parser supports the current annotation, false otherwise 54 */ 55 public boolean supports(Annotation annotation, Class clazz, Member member); 56 }