本文整理了Java中javax.jms.Message.isBodyAssignableTo()
方法的一些代码示例,展示了Message.isBodyAssignableTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.isBodyAssignableTo()
方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:isBodyAssignableTo
[英]Returns whether the message body is capable of being assigned to the specified type. If this method returns true then a subsequent call to the method getBody on the same message with the same type argument would not throw a MessageFormatException.
If the message is a StreamMessage then false is always returned. If the message is a ObjectMessage and object deserialization fails then false is returned. If the message has no body then any type may be specified and true is returned.
[中]返回消息正文是否能够分配给指定的类型。如果此方法返回true,则对具有相同类型参数的同一消息调用方法getBody不会引发MessageFormatException。
如果消息是StreamMessage,则始终返回false。如果消息是ObjectMessage且对象反序列化失败,则返回false。如果消息没有正文,则可以指定任何类型,并返回true。
代码示例来源:origin: org.apache.tomee/openejb-core
@Override
public boolean isBodyAssignableTo(final Class c) throws JMSException {
return message.isBodyAssignableTo(c);
}
代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar
@Override
public boolean isBodyAssignableTo(Class c) throws JMSException {
return message.isBodyAssignableTo(c);
}
代码示例来源:origin: apache/activemq-artemis
@Override
public boolean isBodyAssignableTo(Class c) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("isBodyAssignableTo(" + c + ")");
}
return message.isBodyAssignableTo(c);
}
代码示例来源:origin: org.apache.activemq/artemis-ra
@Override
public boolean isBodyAssignableTo(Class c) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("isBodyAssignableTo(" + c + ")");
}
return message.isBodyAssignableTo(c);
}
代码示例来源:origin: apache/activemq-artemis
Assert.assertEquals(type.toString(), msg.getStringProperty("type"));
for (Class<?> c : clazz) {
Assert.assertEquals(msg + " " + type + " & " + c + ": " + bool, bool, msg.isBodyAssignableTo(c));
if (bool) {
Object receivedBody = msg.getBody(c);
内容来源于网络,如有侵权,请联系作者删除!