Class MessagingAnnotationUtils
java.lang.Object
org.springframework.integration.util.MessagingAnnotationUtils
public final class MessagingAnnotationUtils extends Object
Utility methods to support annotation processing.
- Since:
- 4.0
- Author:
- Gary Russell, Dave Syer, Gunnar Hillert, Soby Chacko, Artem Bilan
-
Method Summary
Modifier and Type Method Description static String
endpointIdValue(Method method)
Return theEndpointId.value()
property, if present.static Method
findAnnotatedMethod(Object target, Class<? extends Annotation> annotationType)
static Annotation
findMessagePartAnnotation(Annotation[] annotations, boolean payloads)
static boolean
hasValue(Object value)
static <T> T
resolveAttribute(List<Annotation> annotations, String name, Class<T> requiredType)
Get the attribute value from the annotation hierarchy, returning the first non-empty value closest to the annotated method.
-
Method Details
-
resolveAttribute
public static <T> T resolveAttribute(List<Annotation> annotations, String name, Class<T> requiredType)Get the attribute value from the annotation hierarchy, returning the first non-empty value closest to the annotated method. While traversing up the hierarchy, for string-valued attributes, an empty string is ignored. For array-valued attributes, an empty array is ignored. The overridden attribute must be the same type.- Type Parameters:
T
- The type.- Parameters:
annotations
- The meta-annotations in order (closest first).name
- The attribute name.requiredType
- The expected type.- Returns:
- The value.
-
hasValue
-
findAnnotatedMethod
public static Method findAnnotatedMethod(Object target, Class<? extends Annotation> annotationType) -
findMessagePartAnnotation
Find the one ofPayload
,Header
orHeaders
annotation from the providedannotations
array. Optionally also detectsPayloads
.- Parameters:
annotations
- the annotations to scan.payloads
- true if @Payloads should be detected.- Returns:
- the matched annotation or
null
. - Throws:
MessagingException
- if more than one ofPayload
,Header
orHeaders
annotations are presented.
-
endpointIdValue
Return theEndpointId.value()
property, if present.- Parameters:
method
- the methods.- Returns:
- the id, or null.
- Since:
- 5.0.4
-