コード例 #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 setBooleanProperty(final String name, final boolean value) throws JMSException {
   Boolean b = Boolean.valueOf(value);
   checkProperty(name, b);
   message.putBooleanProperty(new SimpleString(name), b);
 }