javax.jms.Message.setDoubleProperty()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(245)

本文整理了Java中javax.jms.Message.setDoubleProperty()方法的一些代码示例,展示了Message.setDoubleProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setDoubleProperty()方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:setDoubleProperty

Message.setDoubleProperty介绍

[英]Sets a double property value with the specified name into the message.
[中]在消息中设置具有指定名称的双属性值。

代码示例

代码示例来源:origin: apache/nifi

  1. message.setByteProperty(jmsPropName, Byte.parseByte(value));
  2. } else if (type.equalsIgnoreCase(PROP_TYPE_DOUBLE)) {
  3. message.setDoubleProperty(jmsPropName, Double.parseDouble(value));
  4. } else if (type.equalsIgnoreCase(PROP_TYPE_FLOAT)) {
  5. message.setFloatProperty(jmsPropName, Float.parseFloat(value));

代码示例来源:origin: org.apache.tomee/openejb-core

  1. @Override
  2. public void setDoubleProperty(final String name, final double value) throws JMSException {
  3. message.setDoubleProperty(name, value);
  4. }

代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar

  1. public void setDoubleProperty(String name, double value) throws JMSException {
  2. message.setDoubleProperty(name, value);
  3. }

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. public void setDoubleProperty(String name, double value) throws JMSException
  2. {
  3. message.setDoubleProperty(name, value);
  4. }

代码示例来源:origin: org.apache.qpid/qpid-jca

  1. /**
  2. * Set property
  3. * @param name The name
  4. * @param value The value
  5. * @exception JMSException Thrown if an error occurs
  6. */
  7. public void setDoubleProperty(final String name, final double value) throws JMSException
  8. {
  9. if (_log.isTraceEnabled())
  10. {
  11. _log.trace("setDoubleProperty(" + name + ", " + value + ")");
  12. }
  13. _message.setDoubleProperty(name, value);
  14. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * Set property
  3. *
  4. * @param name The name
  5. * @param value The value
  6. * @throws JMSException Thrown if an error occurs
  7. */
  8. @Override
  9. public void setDoubleProperty(final String name, final double value) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("setDoubleProperty(" + name + ", " + value + ")");
  12. }
  13. message.setDoubleProperty(name, value);
  14. }

代码示例来源:origin: org.apache.activemq/artemis-ra

  1. /**
  2. * Set property
  3. *
  4. * @param name The name
  5. * @param value The value
  6. * @throws JMSException Thrown if an error occurs
  7. */
  8. @Override
  9. public void setDoubleProperty(final String name, final double value) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("setDoubleProperty(" + name + ", " + value + ")");
  12. }
  13. message.setDoubleProperty(name, value);
  14. }

代码示例来源:origin: objectweb-joramtests/joramtests

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * it can also be read as a <code>java.lang.String</code>.
  4. */
  5. public void testDouble2String()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. message.setDoubleProperty("prop", 127.0);
  11. assertEquals("127.0", message.getStringProperty("prop"));
  12. }
  13. catch (JMSException e)
  14. {
  15. fail(e);
  16. }
  17. }

代码示例来源:origin: objectweb-joramtests/joramtests

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * it can also be read as a <code>double</code>.
  4. */
  5. public void testDouble2Double()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. message.setDoubleProperty("prop", 127.0);
  11. assertEquals(127.0, message.getDoubleProperty("prop"), 0);
  12. }
  13. catch (JMSException e)
  14. {
  15. fail(e);
  16. }
  17. }

代码示例来源:origin: objectweb-joramtests/joramtests

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. public void testDouble2Boolean()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. // store a value that can be converted to boolean
  11. message.setDoubleProperty("prop", 127.0);
  12. message.getBooleanProperty("prop");
  13. fail("3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  14. }
  15. catch (MessageFormatException e)
  16. {
  17. }
  18. catch (JMSException e)
  19. {
  20. fail(e);
  21. }
  22. }

代码示例来源:origin: objectweb-joramtests/joramtests

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as an <code>int</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. public void testDouble2Int()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. message.setDoubleProperty("prop", 127.0);
  11. message.getIntProperty("prop");
  12. fail("3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  13. }
  14. catch (MessageFormatException e)
  15. {
  16. }
  17. catch (JMSException e)
  18. {
  19. fail(e);
  20. }
  21. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * it can also be read as a <code>java.lang.String</code>.
  4. */
  5. @Test
  6. public void testDouble2String() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setDoubleProperty("prop", 127.0);
  10. Assert.assertEquals("127.0", message.getStringProperty("prop"));
  11. } catch (JMSException e) {
  12. fail(e);
  13. }
  14. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * it can also be read as a <code>double</code>.
  4. */
  5. @Test
  6. public void testDouble2Double() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setDoubleProperty("prop", 127.0);
  10. Assert.assertEquals(127.0, message.getDoubleProperty("prop"), 0);
  11. } catch (JMSException e) {
  12. fail(e);
  13. }
  14. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testDouble2Short() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. // store a value that can't be converted to short
  10. message.setDoubleProperty("prop", 127.0);
  11. message.getShortProperty("prop");
  12. Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  13. } catch (MessageFormatException e) {
  14. } catch (JMSException e) {
  15. fail(e);
  16. }
  17. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as a <code>long</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testDouble2Long() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setDoubleProperty("prop", 127.0);
  10. message.getLongProperty("prop");
  11. Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  12. } catch (MessageFormatException e) {
  13. } catch (JMSException e) {
  14. fail(e);
  15. }
  16. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as an <code>int</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testDouble2Int() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setDoubleProperty("prop", 127.0);
  10. message.getIntProperty("prop");
  11. Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  12. } catch (MessageFormatException e) {
  13. } catch (JMSException e) {
  14. fail(e);
  15. }
  16. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testDouble2Float() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setDoubleProperty("prop", 127.0);
  10. message.getFloatProperty("prop");
  11. Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  12. } catch (MessageFormatException e) {
  13. } catch (JMSException e) {
  14. fail(e);
  15. }
  16. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testDouble2Byte() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. // store a value that can't be converted to byte
  10. message.setDoubleProperty("prop", 127.0);
  11. message.getByteProperty("prop");
  12. Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  13. } catch (MessageFormatException e) {
  14. } catch (JMSException e) {
  15. fail(e);
  16. }
  17. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * if a property is set as a <code>double</code>,
  3. * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testDouble2Boolean() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. // store a value that can be converted to boolean
  10. message.setDoubleProperty("prop", 127.0);
  11. message.getBooleanProperty("prop");
  12. Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
  13. } catch (MessageFormatException e) {
  14. } catch (JMSException e) {
  15. fail(e);
  16. }
  17. }

代码示例来源:origin: apache/activemq-artemis

  1. protected void prepareMessage(final Message m) throws JMSException {
  2. m.setBooleanProperty("booleanProperty", true);
  3. m.setByteProperty("byteProperty", (byte) 3);
  4. m.setDoubleProperty("doubleProperty", 4.0);
  5. m.setFloatProperty("floatProperty", 5.0f);
  6. m.setIntProperty("intProperty", 6);
  7. m.setLongProperty("longProperty", 7);
  8. m.setShortProperty("shortProperty", (short) 8);
  9. m.setStringProperty("stringProperty", "this is a String property");
  10. m.setJMSCorrelationID("this is the correlation ID");
  11. m.setJMSReplyTo(ActiveMQServerTestCase.topic1);
  12. m.setJMSType("someArbitraryType");
  13. }

相关文章