Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
InboundHeaders |
|
| 0.0;0 |
1 | /* | |
2 | * $Id: InboundHeaders.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 | ||
11 | package org.mule.api.annotations.param; | |
12 | ||
13 | import org.mule.api.annotations.meta.Evaluator; | |
14 | ||
15 | import java.lang.annotation.Documented; | |
16 | import java.lang.annotation.ElementType; | |
17 | import java.lang.annotation.Retention; | |
18 | import java.lang.annotation.RetentionPolicy; | |
19 | import java.lang.annotation.Target; | |
20 | ||
21 | /** | |
22 | * Used on component methods, this annotation marks the method parameter that will be used to pass in one or more of the headers received. | |
23 | * This annotation value can define a single header, a comma-separated list of header names, '*' to denote all headers, or a comma-separated list | |
24 | * of wildcard expressions such as 'MULE_*, X-*'. By default, if a named header is not present on the current message, an exception will be thrown. | |
25 | * However, if the header name is defined with the '?' post fix, it will be marked as optional. | |
26 | * <p/> | |
27 | * When defining multiple header names or using wildcards, the parameter can be a {@link java.util.Map} or {@link java.util.List}. If a | |
28 | * {@link java.util.Map} is used, the header name and value is passed in. If {@link java.util.List} is used, just the header values are used. | |
29 | * If a single header name is defined, the header type can be used as the parameter type, though {@link java.util.List} or {@link java.util.Map} | |
30 | * can be used too. | |
31 | * | |
32 | * The Inbound headers collection is immutable, so the headers Map or List passed in will be immutable too. Attempting to write to the Map or List will result in an {@link UnsupportedOperationException}. | |
33 | */ | |
34 | @Target(ElementType.PARAMETER) | |
35 | @Retention(RetentionPolicy.RUNTIME) | |
36 | @Documented | |
37 | @Evaluator("messageProperty") | |
38 | public @interface InboundHeaders | |
39 | { | |
40 | /** | |
41 | * Defines the headers that should be injected into the parameter. This can be a single header, a comma-separated | |
42 | * list of header names,'*' to denote all headers or a comma-separated list of wildcard expressions. By default, | |
43 | * if a named header is not present, an exception will be thrown. However, if the header name is defined with the | |
44 | * '?' post fix, it will be marked as optional. | |
45 | * The optional '?' post fix is not supported when using wildcard expressions | |
46 | * | |
47 | * @return the header expression used to query the message for headers | |
48 | */ | |
49 | String value(); | |
50 | } |