/** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(Scope scope, JSONWriter jsonWriter) {
    if (scope == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      com.amazonaws.internal.SdkInternalList<String> complianceResourceTypesList =
          (com.amazonaws.internal.SdkInternalList<String>) scope.getComplianceResourceTypes();
      if (!complianceResourceTypesList.isEmpty()
          || !complianceResourceTypesList.isAutoConstruct()) {
        jsonWriter.key("ComplianceResourceTypes");
        jsonWriter.array();
        for (String complianceResourceTypesListValue : complianceResourceTypesList) {
          if (complianceResourceTypesListValue != null) {
            jsonWriter.value(complianceResourceTypesListValue);
          }
        }
        jsonWriter.endArray();
      }

      if (scope.getTagKey() != null) {
        jsonWriter.key("TagKey").value(scope.getTagKey());
      }

      if (scope.getTagValue() != null) {
        jsonWriter.key("TagValue").value(scope.getTagValue());
      }

      if (scope.getComplianceResourceId() != null) {
        jsonWriter.key("ComplianceResourceId").value(scope.getComplianceResourceId());
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
Пример #2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof Scope == false) return false;
    Scope other = (Scope) obj;
    if (other.getComplianceResourceTypes() == null ^ this.getComplianceResourceTypes() == null)
      return false;
    if (other.getComplianceResourceTypes() != null
        && other.getComplianceResourceTypes().equals(this.getComplianceResourceTypes()) == false)
      return false;
    if (other.getTagKey() == null ^ this.getTagKey() == null) return false;
    if (other.getTagKey() != null && other.getTagKey().equals(this.getTagKey()) == false)
      return false;
    if (other.getTagValue() == null ^ this.getTagValue() == null) return false;
    if (other.getTagValue() != null && other.getTagValue().equals(this.getTagValue()) == false)
      return false;
    if (other.getComplianceResourceId() == null ^ this.getComplianceResourceId() == null)
      return false;
    if (other.getComplianceResourceId() != null
        && other.getComplianceResourceId().equals(this.getComplianceResourceId()) == false)
      return false;
    return true;
  }