Esempio n. 1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof Snapshot == false) return false;
    Snapshot other = (Snapshot) obj;
    if (other.getDirectoryId() == null ^ this.getDirectoryId() == null) return false;
    if (other.getDirectoryId() != null
        && other.getDirectoryId().equals(this.getDirectoryId()) == false) return false;
    if (other.getSnapshotId() == null ^ this.getSnapshotId() == null) return false;
    if (other.getSnapshotId() != null
        && other.getSnapshotId().equals(this.getSnapshotId()) == false) return false;
    if (other.getType() == null ^ this.getType() == null) return false;
    if (other.getType() != null && other.getType().equals(this.getType()) == false) return false;
    if (other.getName() == null ^ this.getName() == null) return false;
    if (other.getName() != null && other.getName().equals(this.getName()) == false) return false;
    if (other.getStatus() == null ^ this.getStatus() == null) return false;
    if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
      return false;
    if (other.getStartTime() == null ^ this.getStartTime() == null) return false;
    if (other.getStartTime() != null && other.getStartTime().equals(this.getStartTime()) == false)
      return false;
    return true;
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(Snapshot snapshot, StructuredJsonGenerator jsonGenerator) {

    if (snapshot == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonGenerator.writeStartObject();

      if (snapshot.getDirectoryId() != null) {
        jsonGenerator.writeFieldName("DirectoryId").writeValue(snapshot.getDirectoryId());
      }
      if (snapshot.getSnapshotId() != null) {
        jsonGenerator.writeFieldName("SnapshotId").writeValue(snapshot.getSnapshotId());
      }
      if (snapshot.getType() != null) {
        jsonGenerator.writeFieldName("Type").writeValue(snapshot.getType());
      }
      if (snapshot.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(snapshot.getName());
      }
      if (snapshot.getStatus() != null) {
        jsonGenerator.writeFieldName("Status").writeValue(snapshot.getStatus());
      }
      if (snapshot.getStartTime() != null) {
        jsonGenerator.writeFieldName("StartTime").writeValue(snapshot.getStartTime());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }