示例#1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof Workspace == false) return false;
    Workspace other = (Workspace) obj;
    if (other.getWorkspaceId() == null ^ this.getWorkspaceId() == null) return false;
    if (other.getWorkspaceId() != null
        && other.getWorkspaceId().equals(this.getWorkspaceId()) == false) return false;
    if (other.getDirectoryId() == null ^ this.getDirectoryId() == null) return false;
    if (other.getDirectoryId() != null
        && other.getDirectoryId().equals(this.getDirectoryId()) == false) return false;
    if (other.getUserName() == null ^ this.getUserName() == null) return false;
    if (other.getUserName() != null && other.getUserName().equals(this.getUserName()) == false)
      return false;
    if (other.getIpAddress() == null ^ this.getIpAddress() == null) return false;
    if (other.getIpAddress() != null && other.getIpAddress().equals(this.getIpAddress()) == false)
      return false;
    if (other.getState() == null ^ this.getState() == null) return false;
    if (other.getState() != null && other.getState().equals(this.getState()) == false) return false;
    if (other.getBundleId() == null ^ this.getBundleId() == null) return false;
    if (other.getBundleId() != null && other.getBundleId().equals(this.getBundleId()) == false)
      return false;
    if (other.getSubnetId() == null ^ this.getSubnetId() == null) return false;
    if (other.getSubnetId() != null && other.getSubnetId().equals(this.getSubnetId()) == false)
      return false;
    if (other.getErrorMessage() == null ^ this.getErrorMessage() == null) return false;
    if (other.getErrorMessage() != null
        && other.getErrorMessage().equals(this.getErrorMessage()) == false) return false;
    if (other.getErrorCode() == null ^ this.getErrorCode() == null) return false;
    if (other.getErrorCode() != null && other.getErrorCode().equals(this.getErrorCode()) == false)
      return false;
    if (other.getComputerName() == null ^ this.getComputerName() == null) return false;
    if (other.getComputerName() != null
        && other.getComputerName().equals(this.getComputerName()) == false) return false;
    if (other.getVolumeEncryptionKey() == null ^ this.getVolumeEncryptionKey() == null)
      return false;
    if (other.getVolumeEncryptionKey() != null
        && other.getVolumeEncryptionKey().equals(this.getVolumeEncryptionKey()) == false)
      return false;
    if (other.getUserVolumeEncryptionEnabled() == null
        ^ this.getUserVolumeEncryptionEnabled() == null) return false;
    if (other.getUserVolumeEncryptionEnabled() != null
        && other.getUserVolumeEncryptionEnabled().equals(this.getUserVolumeEncryptionEnabled())
            == false) return false;
    if (other.getRootVolumeEncryptionEnabled() == null
        ^ this.getRootVolumeEncryptionEnabled() == null) return false;
    if (other.getRootVolumeEncryptionEnabled() != null
        && other.getRootVolumeEncryptionEnabled().equals(this.getRootVolumeEncryptionEnabled())
            == false) return false;
    if (other.getWorkspaceProperties() == null ^ this.getWorkspaceProperties() == null)
      return false;
    if (other.getWorkspaceProperties() != null
        && other.getWorkspaceProperties().equals(this.getWorkspaceProperties()) == false)
      return false;
    return true;
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(Workspace workspace, JSONWriter jsonWriter) {
    if (workspace == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (workspace.getWorkspaceId() != null) {
        jsonWriter.key("WorkspaceId").value(workspace.getWorkspaceId());
      }

      if (workspace.getDirectoryId() != null) {
        jsonWriter.key("DirectoryId").value(workspace.getDirectoryId());
      }

      if (workspace.getUserName() != null) {
        jsonWriter.key("UserName").value(workspace.getUserName());
      }

      if (workspace.getIpAddress() != null) {
        jsonWriter.key("IpAddress").value(workspace.getIpAddress());
      }

      if (workspace.getState() != null) {
        jsonWriter.key("State").value(workspace.getState());
      }

      if (workspace.getBundleId() != null) {
        jsonWriter.key("BundleId").value(workspace.getBundleId());
      }

      if (workspace.getSubnetId() != null) {
        jsonWriter.key("SubnetId").value(workspace.getSubnetId());
      }

      if (workspace.getErrorMessage() != null) {
        jsonWriter.key("ErrorMessage").value(workspace.getErrorMessage());
      }

      if (workspace.getErrorCode() != null) {
        jsonWriter.key("ErrorCode").value(workspace.getErrorCode());
      }

      if (workspace.getComputerName() != null) {
        jsonWriter.key("ComputerName").value(workspace.getComputerName());
      }

      if (workspace.getVolumeEncryptionKey() != null) {
        jsonWriter.key("VolumeEncryptionKey").value(workspace.getVolumeEncryptionKey());
      }

      if (workspace.getUserVolumeEncryptionEnabled() != null) {
        jsonWriter
            .key("UserVolumeEncryptionEnabled")
            .value(workspace.getUserVolumeEncryptionEnabled());
      }

      if (workspace.getRootVolumeEncryptionEnabled() != null) {
        jsonWriter
            .key("RootVolumeEncryptionEnabled")
            .value(workspace.getRootVolumeEncryptionEnabled());
      }

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