Example #1
0
 @Override
 public PuObject getPuObject(String fieldName) {
   return PuObject.fromJSON(this.getString(fieldName));
 }
Example #2
0
  public void readPuObject(PuObject data) {
    if (data.variableExists("qos")) {
      this.setQos(data.getInteger("qos"));
    }
    if (data.variableExists("queueName")) {
      this.setQueueName(data.getString("queueName"));
    } else if (data.variableExists("name")) {
      this.setQueueName(data.getString("queueName"));
    }

    if (data.variableExists("autoAck")) {
      this.setAutoAck(data.getBoolean("autoAck"));
    }

    if (data.variableExists("type")) {
      this.setType(MessagingModel.fromName(data.getString("type")));
    } else if (data.variableExists("messagingmodel")) {
      this.setType(MessagingModel.fromName(data.getString("messagingmodel")));
    }

    if (data.variableExists("exchangeName")) {
      this.setExchangeName(data.getString("exchangeName"));
    }

    if (data.variableExists("exchangeType")) {
      this.setExchangeType(data.getString("exchangeType"));
    }

    if (data.variableExists("routingKey")) {
      this.setRoutingKey(data.getString("routingKey"));
    }

    if (data.variableExists("durable")) {
      this.setDurable(data.getBoolean("durable"));
    }

    if (data.variableExists("exclusive")) {
      this.setExclusive(data.getBoolean("exclusive"));
    }

    if (data.variableExists("autoDelete")) {
      this.setAutoDelete(data.getBoolean("autoDelete"));
    }

    if (data.variableExists("arguments")) {
      if (this.arguments == null) {
        this.arguments = new HashMap<>();
      }
      PuObject arguments = data.getPuObject("arguments");
      for (Entry<String, PuValue> entry : arguments) {
        this.arguments.put(entry.getKey(), entry.getValue().getData());
      }
    }
  }