コード例 #1
0
  public void setObjectProperty(final String name, final Object value) throws JMSException {
    checkProperty(name, value);

    SimpleString key = new SimpleString(name);

    if (value instanceof Boolean) {
      message.putBooleanProperty(key, (Boolean) value);
    } else if (value instanceof Byte) {
      message.putByteProperty(key, (Byte) value);
    } else if (value instanceof Short) {
      message.putShortProperty(key, (Short) value);
    } else if (value instanceof Integer) {
      message.putIntProperty(key, (Integer) value);
    } else if (value instanceof Long) {
      message.putLongProperty(key, (Long) value);
    } else if (value instanceof Float) {
      message.putFloatProperty(key, (Float) value);
    } else if (value instanceof Double) {
      message.putDoubleProperty(key, (Double) value);
    } else if (value instanceof String) {
      message.putStringProperty(key, new SimpleString((String) value));
    } else {
      throw new MessageFormatException("Invalid property type");
    }
  }
コード例 #2
0
 public void setDoubleProperty(final String name, final double value) throws JMSException {
   Double d = new Double(value);
   checkProperty(name, d);
   message.putDoubleProperty(new SimpleString(name), d);
 }