/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.comprehend.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ClassifyDocumentResult extends com.amazonaws.AmazonWebServiceResult implements Serializable, Cloneable { /** *

* The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. For * example, an animal can be a dog or a cat, but not both at the same time. *

*/ private java.util.List classes; /** *

* The labels used the document being analyzed. These are used for multi-label trained models. Individual labels * represent different categories that are related in some manner and are not mutually exclusive. For example, a * movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at * the same time. *

*/ private java.util.List labels; /** *

* Extraction information about the document. This field is present in the response only if your request includes * the Byte parameter. *

*/ private DocumentMetadata documentMetadata; /** *

* The document type for each page in the input document. This field is present in the response only if your request * includes the Byte parameter. *

*/ private java.util.List documentType; /** *

* Page-level errors that the system detected while processing the input document. The field is empty if the system * encountered no errors. *

*/ private java.util.List errors; /** *

* Warnings detected while processing the input document. The response includes a warning if there is a mismatch * between the input document type and the model type associated with the endpoint that you specified. The response * can also include warnings for individual pages that have a mismatch. *

*

* The field is empty if the system generated no warnings. *

*/ private java.util.List warnings; /** *

* The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. For * example, an animal can be a dog or a cat, but not both at the same time. *

* * @return The classes used by the document being analyzed. These are used for multi-class trained models. * Individual classes are mutually exclusive and each document is expected to have only a single class * assigned to it. For example, an animal can be a dog or a cat, but not both at the same time. */ public java.util.List getClasses() { return classes; } /** *

* The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. For * example, an animal can be a dog or a cat, but not both at the same time. *

* * @param classes * The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. * For example, an animal can be a dog or a cat, but not both at the same time. */ public void setClasses(java.util.Collection classes) { if (classes == null) { this.classes = null; return; } this.classes = new java.util.ArrayList(classes); } /** *

* The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. For * example, an animal can be a dog or a cat, but not both at the same time. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setClasses(java.util.Collection)} or {@link #withClasses(java.util.Collection)} if you want to override * the existing values. *

* * @param classes * The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. * For example, an animal can be a dog or a cat, but not both at the same time. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withClasses(DocumentClass... classes) { if (this.classes == null) { setClasses(new java.util.ArrayList(classes.length)); } for (DocumentClass ele : classes) { this.classes.add(ele); } return this; } /** *

* The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. For * example, an animal can be a dog or a cat, but not both at the same time. *

* * @param classes * The classes used by the document being analyzed. These are used for multi-class trained models. Individual * classes are mutually exclusive and each document is expected to have only a single class assigned to it. * For example, an animal can be a dog or a cat, but not both at the same time. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withClasses(java.util.Collection classes) { setClasses(classes); return this; } /** *

* The labels used the document being analyzed. These are used for multi-label trained models. Individual labels * represent different categories that are related in some manner and are not mutually exclusive. For example, a * movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at * the same time. *

* * @return The labels used the document being analyzed. These are used for multi-label trained models. Individual * labels represent different categories that are related in some manner and are not mutually exclusive. For * example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and * a comedy, all at the same time. */ public java.util.List getLabels() { return labels; } /** *

* The labels used the document being analyzed. These are used for multi-label trained models. Individual labels * represent different categories that are related in some manner and are not mutually exclusive. For example, a * movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at * the same time. *

* * @param labels * The labels used the document being analyzed. These are used for multi-label trained models. Individual * labels represent different categories that are related in some manner and are not mutually exclusive. For * example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a * comedy, all at the same time. */ public void setLabels(java.util.Collection labels) { if (labels == null) { this.labels = null; return; } this.labels = new java.util.ArrayList(labels); } /** *

* The labels used the document being analyzed. These are used for multi-label trained models. Individual labels * represent different categories that are related in some manner and are not mutually exclusive. For example, a * movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at * the same time. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setLabels(java.util.Collection)} or {@link #withLabels(java.util.Collection)} if you want to override the * existing values. *

* * @param labels * The labels used the document being analyzed. These are used for multi-label trained models. Individual * labels represent different categories that are related in some manner and are not mutually exclusive. For * example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a * comedy, all at the same time. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withLabels(DocumentLabel... labels) { if (this.labels == null) { setLabels(new java.util.ArrayList(labels.length)); } for (DocumentLabel ele : labels) { this.labels.add(ele); } return this; } /** *

* The labels used the document being analyzed. These are used for multi-label trained models. Individual labels * represent different categories that are related in some manner and are not mutually exclusive. For example, a * movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at * the same time. *

* * @param labels * The labels used the document being analyzed. These are used for multi-label trained models. Individual * labels represent different categories that are related in some manner and are not mutually exclusive. For * example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a * comedy, all at the same time. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withLabels(java.util.Collection labels) { setLabels(labels); return this; } /** *

* Extraction information about the document. This field is present in the response only if your request includes * the Byte parameter. *

* * @param documentMetadata * Extraction information about the document. This field is present in the response only if your request * includes the Byte parameter. */ public void setDocumentMetadata(DocumentMetadata documentMetadata) { this.documentMetadata = documentMetadata; } /** *

* Extraction information about the document. This field is present in the response only if your request includes * the Byte parameter. *

* * @return Extraction information about the document. This field is present in the response only if your request * includes the Byte parameter. */ public DocumentMetadata getDocumentMetadata() { return this.documentMetadata; } /** *

* Extraction information about the document. This field is present in the response only if your request includes * the Byte parameter. *

* * @param documentMetadata * Extraction information about the document. This field is present in the response only if your request * includes the Byte parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withDocumentMetadata(DocumentMetadata documentMetadata) { setDocumentMetadata(documentMetadata); return this; } /** *

* The document type for each page in the input document. This field is present in the response only if your request * includes the Byte parameter. *

* * @return The document type for each page in the input document. This field is present in the response only if your * request includes the Byte parameter. */ public java.util.List getDocumentType() { return documentType; } /** *

* The document type for each page in the input document. This field is present in the response only if your request * includes the Byte parameter. *

* * @param documentType * The document type for each page in the input document. This field is present in the response only if your * request includes the Byte parameter. */ public void setDocumentType(java.util.Collection documentType) { if (documentType == null) { this.documentType = null; return; } this.documentType = new java.util.ArrayList(documentType); } /** *

* The document type for each page in the input document. This field is present in the response only if your request * includes the Byte parameter. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setDocumentType(java.util.Collection)} or {@link #withDocumentType(java.util.Collection)} if you want to * override the existing values. *

* * @param documentType * The document type for each page in the input document. This field is present in the response only if your * request includes the Byte parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withDocumentType(DocumentTypeListItem... documentType) { if (this.documentType == null) { setDocumentType(new java.util.ArrayList(documentType.length)); } for (DocumentTypeListItem ele : documentType) { this.documentType.add(ele); } return this; } /** *

* The document type for each page in the input document. This field is present in the response only if your request * includes the Byte parameter. *

* * @param documentType * The document type for each page in the input document. This field is present in the response only if your * request includes the Byte parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withDocumentType(java.util.Collection documentType) { setDocumentType(documentType); return this; } /** *

* Page-level errors that the system detected while processing the input document. The field is empty if the system * encountered no errors. *

* * @return Page-level errors that the system detected while processing the input document. The field is empty if the * system encountered no errors. */ public java.util.List getErrors() { return errors; } /** *

* Page-level errors that the system detected while processing the input document. The field is empty if the system * encountered no errors. *

* * @param errors * Page-level errors that the system detected while processing the input document. The field is empty if the * system encountered no errors. */ public void setErrors(java.util.Collection errors) { if (errors == null) { this.errors = null; return; } this.errors = new java.util.ArrayList(errors); } /** *

* Page-level errors that the system detected while processing the input document. The field is empty if the system * encountered no errors. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setErrors(java.util.Collection)} or {@link #withErrors(java.util.Collection)} if you want to override the * existing values. *

* * @param errors * Page-level errors that the system detected while processing the input document. The field is empty if the * system encountered no errors. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withErrors(ErrorsListItem... errors) { if (this.errors == null) { setErrors(new java.util.ArrayList(errors.length)); } for (ErrorsListItem ele : errors) { this.errors.add(ele); } return this; } /** *

* Page-level errors that the system detected while processing the input document. The field is empty if the system * encountered no errors. *

* * @param errors * Page-level errors that the system detected while processing the input document. The field is empty if the * system encountered no errors. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withErrors(java.util.Collection errors) { setErrors(errors); return this; } /** *

* Warnings detected while processing the input document. The response includes a warning if there is a mismatch * between the input document type and the model type associated with the endpoint that you specified. The response * can also include warnings for individual pages that have a mismatch. *

*

* The field is empty if the system generated no warnings. *

* * @return Warnings detected while processing the input document. The response includes a warning if there is a * mismatch between the input document type and the model type associated with the endpoint that you * specified. The response can also include warnings for individual pages that have a mismatch.

*

* The field is empty if the system generated no warnings. */ public java.util.List getWarnings() { return warnings; } /** *

* Warnings detected while processing the input document. The response includes a warning if there is a mismatch * between the input document type and the model type associated with the endpoint that you specified. The response * can also include warnings for individual pages that have a mismatch. *

*

* The field is empty if the system generated no warnings. *

* * @param warnings * Warnings detected while processing the input document. The response includes a warning if there is a * mismatch between the input document type and the model type associated with the endpoint that you * specified. The response can also include warnings for individual pages that have a mismatch.

*

* The field is empty if the system generated no warnings. */ public void setWarnings(java.util.Collection warnings) { if (warnings == null) { this.warnings = null; return; } this.warnings = new java.util.ArrayList(warnings); } /** *

* Warnings detected while processing the input document. The response includes a warning if there is a mismatch * between the input document type and the model type associated with the endpoint that you specified. The response * can also include warnings for individual pages that have a mismatch. *

*

* The field is empty if the system generated no warnings. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setWarnings(java.util.Collection)} or {@link #withWarnings(java.util.Collection)} if you want to override * the existing values. *

* * @param warnings * Warnings detected while processing the input document. The response includes a warning if there is a * mismatch between the input document type and the model type associated with the endpoint that you * specified. The response can also include warnings for individual pages that have a mismatch.

*

* The field is empty if the system generated no warnings. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withWarnings(WarningsListItem... warnings) { if (this.warnings == null) { setWarnings(new java.util.ArrayList(warnings.length)); } for (WarningsListItem ele : warnings) { this.warnings.add(ele); } return this; } /** *

* Warnings detected while processing the input document. The response includes a warning if there is a mismatch * between the input document type and the model type associated with the endpoint that you specified. The response * can also include warnings for individual pages that have a mismatch. *

*

* The field is empty if the system generated no warnings. *

* * @param warnings * Warnings detected while processing the input document. The response includes a warning if there is a * mismatch between the input document type and the model type associated with the endpoint that you * specified. The response can also include warnings for individual pages that have a mismatch.

*

* The field is empty if the system generated no warnings. * @return Returns a reference to this object so that method calls can be chained together. */ public ClassifyDocumentResult withWarnings(java.util.Collection warnings) { setWarnings(warnings); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getClasses() != null) sb.append("Classes: ").append(getClasses()).append(","); if (getLabels() != null) sb.append("Labels: ").append(getLabels()).append(","); if (getDocumentMetadata() != null) sb.append("DocumentMetadata: ").append(getDocumentMetadata()).append(","); if (getDocumentType() != null) sb.append("DocumentType: ").append(getDocumentType()).append(","); if (getErrors() != null) sb.append("Errors: ").append(getErrors()).append(","); if (getWarnings() != null) sb.append("Warnings: ").append(getWarnings()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ClassifyDocumentResult == false) return false; ClassifyDocumentResult other = (ClassifyDocumentResult) obj; if (other.getClasses() == null ^ this.getClasses() == null) return false; if (other.getClasses() != null && other.getClasses().equals(this.getClasses()) == false) return false; if (other.getLabels() == null ^ this.getLabels() == null) return false; if (other.getLabels() != null && other.getLabels().equals(this.getLabels()) == false) return false; if (other.getDocumentMetadata() == null ^ this.getDocumentMetadata() == null) return false; if (other.getDocumentMetadata() != null && other.getDocumentMetadata().equals(this.getDocumentMetadata()) == false) return false; if (other.getDocumentType() == null ^ this.getDocumentType() == null) return false; if (other.getDocumentType() != null && other.getDocumentType().equals(this.getDocumentType()) == false) return false; if (other.getErrors() == null ^ this.getErrors() == null) return false; if (other.getErrors() != null && other.getErrors().equals(this.getErrors()) == false) return false; if (other.getWarnings() == null ^ this.getWarnings() == null) return false; if (other.getWarnings() != null && other.getWarnings().equals(this.getWarnings()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getClasses() == null) ? 0 : getClasses().hashCode()); hashCode = prime * hashCode + ((getLabels() == null) ? 0 : getLabels().hashCode()); hashCode = prime * hashCode + ((getDocumentMetadata() == null) ? 0 : getDocumentMetadata().hashCode()); hashCode = prime * hashCode + ((getDocumentType() == null) ? 0 : getDocumentType().hashCode()); hashCode = prime * hashCode + ((getErrors() == null) ? 0 : getErrors().hashCode()); hashCode = prime * hashCode + ((getWarnings() == null) ? 0 : getWarnings().hashCode()); return hashCode; } @Override public ClassifyDocumentResult clone() { try { return (ClassifyDocumentResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }