public final class IntegrationUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
fatalWhenNoBeanFactory
Should be set to TRUE on CI plans and framework developer systems.
|
static java.lang.String |
INTEGRATION_CONVERSION_SERVICE_BEAN_NAME |
static java.lang.String |
INTEGRATION_MESSAGE_BUILDER_FACTORY_BEAN_NAME |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
bytesToString(byte[] bytes,
java.lang.String encoding)
Utility method for null-safe conversion from byte[] to String
|
static org.springframework.core.convert.ConversionService |
getConversionService(org.springframework.beans.factory.BeanFactory beanFactory) |
static MessageBuilderFactory |
getMessageBuilderFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Returns the context-wide `messageBuilderFactory` bean from the beanFactory,
or a
DefaultMessageBuilderFactory if not found or the beanFactory is null. |
static byte[] |
stringToBytes(java.lang.String value,
java.lang.String encoding)
Utility method for null-safe conversion from String to byte[]
|
static java.lang.RuntimeException |
wrapInDeliveryExceptionIfNecessary(org.springframework.messaging.Message<?> message,
java.util.function.Supplier<java.lang.String> text,
java.lang.Exception e)
If the exception is not a
MessagingException or does not have
a failedMessage, wrap it
in a new MessageDeliveryException with the message. |
static java.lang.RuntimeException |
wrapInHandlingExceptionIfNecessary(org.springframework.messaging.Message<?> message,
java.util.function.Supplier<java.lang.String> text,
java.lang.Exception e)
If the exception is not a
MessagingException or does not have
a failedMessage, wrap it
in a new MessageHandlingException with the message. |
public static final java.lang.String INTEGRATION_CONVERSION_SERVICE_BEAN_NAME
public static final java.lang.String INTEGRATION_MESSAGE_BUILDER_FACTORY_BEAN_NAME
public static final boolean fatalWhenNoBeanFactory
public static org.springframework.core.convert.ConversionService getConversionService(org.springframework.beans.factory.BeanFactory beanFactory)
beanFactory - BeanFactory for lookup, must not be null.ConversionService bean whose name is "integrationConversionService" if available.public static MessageBuilderFactory getMessageBuilderFactory(org.springframework.beans.factory.BeanFactory beanFactory)
DefaultMessageBuilderFactory if not found or the beanFactory is null.beanFactory - The bean factory.public static byte[] stringToBytes(java.lang.String value,
java.lang.String encoding)
value - the String to be convertedencoding - the encodingjava.lang.IllegalArgumentException - if the encoding is not supportedpublic static java.lang.String bytesToString(byte[] bytes,
java.lang.String encoding)
bytes - the byte[] to be convertedencoding - the encodingjava.lang.IllegalArgumentException - if the encoding is not supportedpublic static java.lang.RuntimeException wrapInDeliveryExceptionIfNecessary(org.springframework.messaging.Message<?> message,
java.util.function.Supplier<java.lang.String> text,
java.lang.Exception e)
MessagingException or does not have
a failedMessage, wrap it
in a new MessageDeliveryException with the message.message - the message.text - a Supplier for the new exception's message text.e - the exception.public static java.lang.RuntimeException wrapInHandlingExceptionIfNecessary(org.springframework.messaging.Message<?> message,
java.util.function.Supplier<java.lang.String> text,
java.lang.Exception e)
MessagingException or does not have
a failedMessage, wrap it
in a new MessageHandlingException with the message.message - the message.text - a Supplier for the new exception's message text.e - the exception.