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

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

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

Message.getFloatProperty介绍

[英]Returns the value of the float property with the specified name.
[中]返回具有指定名称的float属性的值。

代码示例

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

  1. @Override
  2. public float getFloatProperty(final String name) throws JMSException {
  3. return message.getFloatProperty(name);
  4. }

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

  1. public float getFloatProperty(String name) throws JMSException
  2. {
  3. return message.getFloatProperty(name);
  4. }

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

  1. public float getFloatProperty(String name) throws JMSException {
  2. return message.getFloatProperty(name);
  3. }

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

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

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

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

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

  1. /**
  2. * Get property
  3. *
  4. * @param name The name
  5. * @return The value
  6. * @throws JMSException Thrown if an error occurs
  7. */
  8. @Override
  9. public float getFloatProperty(final String name) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("getFloatProperty(" + name + ")");
  12. }
  13. return message.getFloatProperty(name);
  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>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. try {
  10. float booleanProperty = message.getFloatProperty(key);
  11. context.setReturnValues(new BFloat(booleanProperty));
  12. } catch (JMSException e) {
  13. BallerinaAdapter.returnError("Error when retrieving float property", context, e);
  14. }
  15. }
  16. }

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

  1. /**
  2. * if a property is set as a <code>Float</code> with the <code>Message.setObjectProperty()</code>
  3. * method, it can be retrieve directly as a <code>double</code> by <code>Message.getFloatProperty()</code>
  4. */
  5. @Test
  6. public void testSetObjectProperty_1() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setObjectProperty("pi", new Float(3.14159f));
  10. Assert.assertEquals(3.14159f, message.getFloatProperty("pi"), 0);
  11. } catch (JMSException e) {
  12. fail(e);
  13. }
  14. }

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

  1. /**
  2. * Test that an attempt to get a <code>float</code> property which does not exist throw
  3. * a <code>java.lang.NullPointerException</code>
  4. */
  5. @Test
  6. public void testGetFloatProperty() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.getFloatProperty("prop");
  10. Assert.fail("Should raise a NullPointerException.\n");
  11. } catch (NullPointerException e) {
  12. } catch (JMSException e) {
  13. fail(e);
  14. }
  15. }

代码示例来源: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>java.lang.String</code>,
  3. * it can also be read as a <code>float</code> as long as the <code>String</code>
  4. * is a correct representation of a <code>float</code> (e.g. <code>"3.14159"</code>).
  5. */
  6. @Test
  7. public void testString2Float_1() {
  8. try {
  9. Message message = senderSession.createMessage();
  10. message.setStringProperty("pi", "3.14159");
  11. Assert.assertEquals(3.14159F, message.getFloatProperty("pi"), 0);
  12. } catch (JMSException e) {
  13. fail(e);
  14. }
  15. }

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

  1. /**
  2. * if a property is set as a <code>int</code>,
  3. * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testInt2Float() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setIntProperty("prop", 127);
  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>long</code>,
  3. * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testLong2Float() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setLongProperty("prop", 127L);
  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>byte</code>,
  3. * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testByte2Float() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setByteProperty("prop", (byte) 127);
  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>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>short</code>,
  3. * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testShort2Float() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setShortProperty("prop", (short) 127);
  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>boolean</code>,
  3. * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
  4. */
  5. @Test
  6. public void testBoolean2Float() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. // store a value that can't be converted to float
  10. message.setBooleanProperty("prop", true);
  11. message.getFloatProperty("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>java.lang.String</code>,
  3. * to get it as a <code>float</code> throws a <code>java.lang.NuberFormatException</code>
  4. * if the <code>String</code> is not a correct representation for a <code>float</code>
  5. * (e.g. <code>"not_a_number"</code>).
  6. */
  7. @Test
  8. public void testString2Float_2() {
  9. try {
  10. Message message = senderSession.createMessage();
  11. message.setStringProperty("pi", "not_a_number");
  12. message.getFloatProperty("pi");
  13. Assert.fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
  14. } catch (java.lang.NumberFormatException e) {
  15. } catch (JMSException e) {
  16. fail(e);
  17. }
  18. }

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

  1. protected void assertEquivalent(final Message m, final int mode, final boolean redelivered) throws JMSException {
  2. ProxyAssertSupport.assertNotNull(m);
  3. ProxyAssertSupport.assertEquals(true, m.getBooleanProperty("booleanProperty"));
  4. ProxyAssertSupport.assertEquals((byte) 3, m.getByteProperty("byteProperty"));
  5. ProxyAssertSupport.assertEquals(new Double(4.0), new Double(m.getDoubleProperty("doubleProperty")));
  6. ProxyAssertSupport.assertEquals(new Float(5.0f), new Float(m.getFloatProperty("floatProperty")));
  7. ProxyAssertSupport.assertEquals(6, m.getIntProperty("intProperty"));
  8. ProxyAssertSupport.assertEquals(7, m.getLongProperty("longProperty"));
  9. ProxyAssertSupport.assertEquals((short) 8, m.getShortProperty("shortProperty"));
  10. ProxyAssertSupport.assertEquals("this is a String property", m.getStringProperty("stringProperty"));
  11. ProxyAssertSupport.assertEquals("this is the correlation ID", m.getJMSCorrelationID());
  12. ProxyAssertSupport.assertEquals(ActiveMQServerTestCase.topic1, m.getJMSReplyTo());
  13. ProxyAssertSupport.assertEquals("someArbitraryType", m.getJMSType());
  14. ProxyAssertSupport.assertEquals(queue1, m.getJMSDestination());
  15. ProxyAssertSupport.assertEquals("JMS Redelivered property", m.getJMSRedelivered(), redelivered);
  16. ProxyAssertSupport.assertEquals(mode, m.getJMSDeliveryMode());
  17. }

相关文章