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

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

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

Message.setFloatProperty介绍

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

代码示例

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

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

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

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

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

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

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

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

代码示例来源: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 setFloatProperty(final String name, final float value) throws JMSException
  8. {
  9. if (_log.isTraceEnabled())
  10. {
  11. _log.trace("setFloatProperty(" + name + ", " + value + ")");
  12. }
  13. _message.setFloatProperty(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 setFloatProperty(final String name, final float value) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("setFloatProperty(" + name + ", " + value + ")");
  12. }
  13. message.setFloatProperty(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 setFloatProperty(final String name, final float value) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("setFloatProperty(" + name + ", " + value + ")");
  12. }
  13. message.setFloatProperty(name, value);
  14. }

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

  1. /**
  2. * if a property is set as a <code>float</code>,
  3. * it can also be read as a <code>double</code>.
  4. */
  5. public void testFloat2Double()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * it can also be read as a <code>String</code>.
  4. */
  5. public void testFloat2String()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * it can also be read as a <code>float</code>.
  4. */
  5. public void testFloat2Float()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. message.setFloatProperty("prop", 127.0F);
  11. assertEquals(127.0F, message.getFloatProperty("prop"), 0);
  12. }
  13. catch (JMSException e)
  14. {
  15. fail(e);
  16. }
  17. }

代码示例来源:origin: org.ballerinalang/ballerina-jms

  1. @Override
  2. public void execute(Context context, CallableUnitCallback callableUnitCallback) {
  3. Struct messageStruct = BallerinaAdapter.getReceiverObject(context);
  4. Message message = BallerinaAdapter.getNativeObject(messageStruct,
  5. Constants.JMS_MESSAGE_OBJECT,
  6. Message.class,
  7. context);
  8. String key = context.getStringArgument(0);
  9. double value = context.getFloatArgument(0);
  10. try {
  11. message.setFloatProperty(key, (float) value);
  12. } catch (JMSException e) {
  13. BallerinaAdapter.returnError("Error when setting float property", context, e);
  14. }
  15. }
  16. }

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

  1. /**
  2. * if a property is set as a <code>float</code>,
  3. * it can also be read as a <code>double</code>.
  4. */
  5. @Test
  6. public void testFloat2Double() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * it can also be read as a <code>String</code>.
  4. */
  5. @Test
  6. public void testFloat2String() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * it can also be read as a <code>float</code>.
  4. */
  5. @Test
  6. public void testFloat2Float() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setFloatProperty("prop", 127.0F);
  10. Assert.assertEquals(127.0F, message.getFloatProperty("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>float</code>,
  3. * to get is as a <code>int</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testFloat2Int() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testFloat2Short() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. // store a value that can't be converted to short
  10. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testFloat2Byte() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. // store a value that can't be converted to byte
  10. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * to get is as a <code>long</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testFloat2Long() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setFloatProperty("prop", 127.0F);
  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>float</code>,
  3. * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testFloat2Boolean() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. // store a value that can be converted to boolean
  10. message.setFloatProperty("prop", 127.0F);
  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. }

相关文章