本文整理了Java中javax.jms.Message.getFloatProperty()
方法的一些代码示例,展示了Message.getFloatProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getFloatProperty()
方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:getFloatProperty
[英]Returns the value of the float property with the specified name.
[中]返回具有指定名称的float属性的值。
代码示例来源:origin: org.apache.tomee/openejb-core
@Override
public float getFloatProperty(final String name) throws JMSException {
return message.getFloatProperty(name);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
public float getFloatProperty(String name) throws JMSException
{
return message.getFloatProperty(name);
}
代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar
public float getFloatProperty(String name) throws JMSException {
return message.getFloatProperty(name);
}
代码示例来源:origin: org.apache.qpid/qpid-jca
/**
* Get property
* @param name The name
* @return The value
* @exception JMSException Thrown if an error occurs
*/
public float getFloatProperty(final String name) throws JMSException
{
if (_log.isTraceEnabled())
{
_log.trace("getFloatProperty(" + name + ")");
}
return _message.getFloatProperty(name);
}
代码示例来源:origin: apache/activemq-artemis
/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public float getFloatProperty(final String name) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("getFloatProperty(" + name + ")");
}
return message.getFloatProperty(name);
}
代码示例来源:origin: org.apache.activemq/artemis-ra
/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public float getFloatProperty(final String name) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("getFloatProperty(" + name + ")");
}
return message.getFloatProperty(name);
}
代码示例来源:origin: objectweb-joramtests/joramtests
/**
* if a property is set as a <code>float</code>,
* it can also be read as a <code>float</code>.
*/
public void testFloat2Float()
{
try
{
Message message = senderSession.createMessage();
message.setFloatProperty("prop", 127.0F);
assertEquals(127.0F, message.getFloatProperty("prop"), 0);
}
catch (JMSException e)
{
fail(e);
}
}
代码示例来源:origin: org.ballerinalang/ballerina-jms
@Override
public void execute(Context context, CallableUnitCallback callableUnitCallback) {
Struct messageStruct = BallerinaAdapter.getReceiverObject(context);
Message message = BallerinaAdapter.getNativeObject(messageStruct,
Constants.JMS_MESSAGE_OBJECT,
Message.class,
context);
String key = context.getStringArgument(0);
try {
float booleanProperty = message.getFloatProperty(key);
context.setReturnValues(new BFloat(booleanProperty));
} catch (JMSException e) {
BallerinaAdapter.returnError("Error when retrieving float property", context, e);
}
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>Float</code> with the <code>Message.setObjectProperty()</code>
* method, it can be retrieve directly as a <code>double</code> by <code>Message.getFloatProperty()</code>
*/
@Test
public void testSetObjectProperty_1() {
try {
Message message = senderSession.createMessage();
message.setObjectProperty("pi", new Float(3.14159f));
Assert.assertEquals(3.14159f, message.getFloatProperty("pi"), 0);
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* Test that an attempt to get a <code>float</code> property which does not exist throw
* a <code>java.lang.NullPointerException</code>
*/
@Test
public void testGetFloatProperty() {
try {
Message message = senderSession.createMessage();
message.getFloatProperty("prop");
Assert.fail("Should raise a NullPointerException.\n");
} catch (NullPointerException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>float</code>,
* it can also be read as a <code>float</code>.
*/
@Test
public void testFloat2Float() {
try {
Message message = senderSession.createMessage();
message.setFloatProperty("prop", 127.0F);
Assert.assertEquals(127.0F, message.getFloatProperty("prop"), 0);
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>java.lang.String</code>,
* it can also be read as a <code>float</code> as long as the <code>String</code>
* is a correct representation of a <code>float</code> (e.g. <code>"3.14159"</code>).
*/
@Test
public void testString2Float_1() {
try {
Message message = senderSession.createMessage();
message.setStringProperty("pi", "3.14159");
Assert.assertEquals(3.14159F, message.getFloatProperty("pi"), 0);
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>int</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testInt2Float() {
try {
Message message = senderSession.createMessage();
message.setIntProperty("prop", 127);
message.getFloatProperty("prop");
Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
} catch (MessageFormatException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>long</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testLong2Float() {
try {
Message message = senderSession.createMessage();
message.setLongProperty("prop", 127L);
message.getFloatProperty("prop");
Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
} catch (MessageFormatException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>byte</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testByte2Float() {
try {
Message message = senderSession.createMessage();
message.setByteProperty("prop", (byte) 127);
message.getFloatProperty("prop");
Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
} catch (MessageFormatException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>double</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testDouble2Float() {
try {
Message message = senderSession.createMessage();
message.setDoubleProperty("prop", 127.0);
message.getFloatProperty("prop");
Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
} catch (MessageFormatException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>short</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testShort2Float() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
message.getFloatProperty("prop");
Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
} catch (MessageFormatException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>boolean</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testBoolean2Float() {
try {
Message message = senderSession.createMessage();
// store a value that can't be converted to float
message.setBooleanProperty("prop", true);
message.getFloatProperty("prop");
Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
} catch (MessageFormatException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* if a property is set as a <code>java.lang.String</code>,
* to get it as a <code>float</code> throws a <code>java.lang.NuberFormatException</code>
* if the <code>String</code> is not a correct representation for a <code>float</code>
* (e.g. <code>"not_a_number"</code>).
*/
@Test
public void testString2Float_2() {
try {
Message message = senderSession.createMessage();
message.setStringProperty("pi", "not_a_number");
message.getFloatProperty("pi");
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");
} catch (java.lang.NumberFormatException e) {
} catch (JMSException e) {
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
protected void assertEquivalent(final Message m, final int mode, final boolean redelivered) throws JMSException {
ProxyAssertSupport.assertNotNull(m);
ProxyAssertSupport.assertEquals(true, m.getBooleanProperty("booleanProperty"));
ProxyAssertSupport.assertEquals((byte) 3, m.getByteProperty("byteProperty"));
ProxyAssertSupport.assertEquals(new Double(4.0), new Double(m.getDoubleProperty("doubleProperty")));
ProxyAssertSupport.assertEquals(new Float(5.0f), new Float(m.getFloatProperty("floatProperty")));
ProxyAssertSupport.assertEquals(6, m.getIntProperty("intProperty"));
ProxyAssertSupport.assertEquals(7, m.getLongProperty("longProperty"));
ProxyAssertSupport.assertEquals((short) 8, m.getShortProperty("shortProperty"));
ProxyAssertSupport.assertEquals("this is a String property", m.getStringProperty("stringProperty"));
ProxyAssertSupport.assertEquals("this is the correlation ID", m.getJMSCorrelationID());
ProxyAssertSupport.assertEquals(ActiveMQServerTestCase.topic1, m.getJMSReplyTo());
ProxyAssertSupport.assertEquals("someArbitraryType", m.getJMSType());
ProxyAssertSupport.assertEquals(queue1, m.getJMSDestination());
ProxyAssertSupport.assertEquals("JMS Redelivered property", m.getJMSRedelivered(), redelivered);
ProxyAssertSupport.assertEquals(mode, m.getJMSDeliveryMode());
}
内容来源于网络,如有侵权,请联系作者删除!