Class MessagingAnnotationUtils
java.lang.Object
org.springframework.integration.util.MessagingAnnotationUtils
Utility methods to support annotation processing.
- Since:
- 4.0
- Author:
- Gary Russell, Dave Syer, Gunnar Hillert, Soby Chacko, Artem Bilan, Chris Bono, Ngoc Nhan
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringendpointIdValue(Method method) Return theEndpointId.value()property, if present.static StringendpointIdValue(MergedAnnotations mergedAnnotations) Return theEndpointId.value()property, if present.static MethodfindAnnotatedMethod(Object target, Class<? extends Annotation> annotationType) static AnnotationfindMessagePartAnnotation(Annotation[] annotations, boolean payloads) static List<Annotation>getAnnotationChain(Annotation messagingAnnotation, Class<? extends Annotation> annotationType) Get a chain of its meta-annotations for the provided instance and expected type.static booleanDetermine if the value of a named attribute from an annotation instance contains an actual value.static <T> TresolveAttribute(List<Annotation> annotations, String name, Class<T> requiredType) Get the attribute value from the annotation hierarchy, returning the firstnon-empty) value closest to the annotated method.
- 
Method Details- 
resolveAttributepublic static <T> T resolveAttribute(List<Annotation> annotations, String name, Class<T> requiredType) Get the attribute value from the annotation hierarchy, returning the firstnon-empty) value closest to the annotated method.- 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.
 
- 
hasValueDetermine if the value of a named attribute from an annotation instance contains an actual value.- Parameters:
- annotationValue- the value of the annotation attribute
- Returns:
- falsewhen- annotationValueis null, an empty string, an empty array, or any annotation whose 'value' field is set to- ValueConstants.DEFAULT_NONE-- trueotherwise
 
- 
findAnnotatedMethod
- 
findMessagePartAnnotationFind the one ofPayload,HeaderorHeadersannotation from the providedannotationsarray. 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 of- Payload,- Headeror- Headersannotations are presented.
 
- 
endpointIdValueReturn theEndpointId.value()property, if present.- Parameters:
- method- the methods.
- Returns:
- the id, or null.
- Since:
- 5.0.4
 
- 
endpointIdValueReturn theEndpointId.value()property, if present.- Parameters:
- mergedAnnotations- the- MergedAnnotationsto analyze.
- Returns:
- the id, or null.
- Since:
- 6.0
 
- 
getAnnotationChainpublic static List<Annotation> getAnnotationChain(Annotation messagingAnnotation, Class<? extends Annotation> annotationType) Get a chain of its meta-annotations for the provided instance and expected type.- Parameters:
- messagingAnnotation- the- Annotationto take a chain for its meta-annotations.
- annotationType- the annotation type.
- Returns:
- the hierarchical list of annotations in top-bottom order.
- Since:
- 6.0
 
 
-