/* * Copyright 2010-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.textract.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *

* Analyzes an input document for relationships between detected items. *

*

* The types of information returned are as follows: *

* *

* Selection elements such as check boxes and option buttons (radio buttons) can * be detected in form data and in tables. A SELECTION_ELEMENT * Block object contains information about a selection element, * including the selection status. *

*

* You can choose which type of analysis to perform by specifying the * FeatureTypes list. *

*

* The output is returned in a list of Block objects. *

*

* AnalyzeDocument is a synchronous operation. To analyze documents * asynchronously, use StartDocumentAnalysis. *

*

* For more information, see Document Text Analysis. *

*/ public class AnalyzeDocumentRequest extends AmazonWebServiceRequest implements Serializable { /** *

* The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *

*

* If you're using an AWS SDK to call Amazon Textract, you might not need to * base64-encode image bytes that are passed using the Bytes * field. *

*/ private Document document; /** *

* A list of the types of analysis to perform. Add TABLES to the list to * return information about the tables that are detected in the input * document. Add FORMS to return detected form data. Add SIGNATURES to * return the locations of detected signatures. To perform both forms and * table analysis, add TABLES and FORMS to FeatureTypes. To * detect signatures within form data and table data, add SIGNATURES to * either TABLES or FORMS. All lines and words detected in the document are * included in the response (including text that isn't related to the value * of FeatureTypes). *

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

* Sets the configuration for the human in the loop workflow for analyzing * documents. *

*/ private HumanLoopConfig humanLoopConfig; /** *

* Contains Queries and the alias for those Queries, as determined by the * input. *

*/ private QueriesConfig queriesConfig; /** *

* The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *

*

* If you're using an AWS SDK to call Amazon Textract, you might not need to * base64-encode image bytes that are passed using the Bytes * field. *

* * @return

* The input document as base64-encoded bytes or an Amazon S3 * object. If you use the AWS CLI to call Amazon Textract * operations, you can't pass image bytes. The document must be an * image in JPEG, PNG, PDF, or TIFF format. *

*

* If you're using an AWS SDK to call Amazon Textract, you might not * need to base64-encode image bytes that are passed using the * Bytes field. *

*/ public Document getDocument() { return document; } /** *

* The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *

*

* If you're using an AWS SDK to call Amazon Textract, you might not need to * base64-encode image bytes that are passed using the Bytes * field. *

* * @param document

* The input document as base64-encoded bytes or an Amazon S3 * object. If you use the AWS CLI to call Amazon Textract * operations, you can't pass image bytes. The document must be * an image in JPEG, PNG, PDF, or TIFF format. *

*

* If you're using an AWS SDK to call Amazon Textract, you might * not need to base64-encode image bytes that are passed using * the Bytes field. *

*/ public void setDocument(Document document) { this.document = document; } /** *

* The input document as base64-encoded bytes or an Amazon S3 object. If you * use the AWS CLI to call Amazon Textract operations, you can't pass image * bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format. *

*

* If you're using an AWS SDK to call Amazon Textract, you might not need to * base64-encode image bytes that are passed using the Bytes * field. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param document

* The input document as base64-encoded bytes or an Amazon S3 * object. If you use the AWS CLI to call Amazon Textract * operations, you can't pass image bytes. The document must be * an image in JPEG, PNG, PDF, or TIFF format. *

*

* If you're using an AWS SDK to call Amazon Textract, you might * not need to base64-encode image bytes that are passed using * the Bytes field. *

* @return A reference to this updated object so that method calls can be * chained together. */ public AnalyzeDocumentRequest withDocument(Document document) { this.document = document; return this; } /** *

* A list of the types of analysis to perform. Add TABLES to the list to * return information about the tables that are detected in the input * document. Add FORMS to return detected form data. Add SIGNATURES to * return the locations of detected signatures. To perform both forms and * table analysis, add TABLES and FORMS to FeatureTypes. To * detect signatures within form data and table data, add SIGNATURES to * either TABLES or FORMS. All lines and words detected in the document are * included in the response (including text that isn't related to the value * of FeatureTypes). *

* * @return

* A list of the types of analysis to perform. Add TABLES to the * list to return information about the tables that are detected in * the input document. Add FORMS to return detected form data. Add * SIGNATURES to return the locations of detected signatures. To * perform both forms and table analysis, add TABLES and FORMS to * FeatureTypes. To detect signatures within form data * and table data, add SIGNATURES to either TABLES or FORMS. All * lines and words detected in the document are included in the * response (including text that isn't related to the value of * FeatureTypes). *

*/ public java.util.List getFeatureTypes() { return featureTypes; } /** *

* A list of the types of analysis to perform. Add TABLES to the list to * return information about the tables that are detected in the input * document. Add FORMS to return detected form data. Add SIGNATURES to * return the locations of detected signatures. To perform both forms and * table analysis, add TABLES and FORMS to FeatureTypes. To * detect signatures within form data and table data, add SIGNATURES to * either TABLES or FORMS. All lines and words detected in the document are * included in the response (including text that isn't related to the value * of FeatureTypes). *

* * @param featureTypes

* A list of the types of analysis to perform. Add TABLES to the * list to return information about the tables that are detected * in the input document. Add FORMS to return detected form data. * Add SIGNATURES to return the locations of detected signatures. * To perform both forms and table analysis, add TABLES and FORMS * to FeatureTypes. To detect signatures within form * data and table data, add SIGNATURES to either TABLES or FORMS. * All lines and words detected in the document are included in * the response (including text that isn't related to the value * of FeatureTypes). *

*/ public void setFeatureTypes(java.util.Collection featureTypes) { if (featureTypes == null) { this.featureTypes = null; return; } this.featureTypes = new java.util.ArrayList(featureTypes); } /** *

* A list of the types of analysis to perform. Add TABLES to the list to * return information about the tables that are detected in the input * document. Add FORMS to return detected form data. Add SIGNATURES to * return the locations of detected signatures. To perform both forms and * table analysis, add TABLES and FORMS to FeatureTypes. To * detect signatures within form data and table data, add SIGNATURES to * either TABLES or FORMS. All lines and words detected in the document are * included in the response (including text that isn't related to the value * of FeatureTypes). *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param featureTypes

* A list of the types of analysis to perform. Add TABLES to the * list to return information about the tables that are detected * in the input document. Add FORMS to return detected form data. * Add SIGNATURES to return the locations of detected signatures. * To perform both forms and table analysis, add TABLES and FORMS * to FeatureTypes. To detect signatures within form * data and table data, add SIGNATURES to either TABLES or FORMS. * All lines and words detected in the document are included in * the response (including text that isn't related to the value * of FeatureTypes). *

* @return A reference to this updated object so that method calls can be * chained together. */ public AnalyzeDocumentRequest withFeatureTypes(String... featureTypes) { if (getFeatureTypes() == null) { this.featureTypes = new java.util.ArrayList(featureTypes.length); } for (String value : featureTypes) { this.featureTypes.add(value); } return this; } /** *

* A list of the types of analysis to perform. Add TABLES to the list to * return information about the tables that are detected in the input * document. Add FORMS to return detected form data. Add SIGNATURES to * return the locations of detected signatures. To perform both forms and * table analysis, add TABLES and FORMS to FeatureTypes. To * detect signatures within form data and table data, add SIGNATURES to * either TABLES or FORMS. All lines and words detected in the document are * included in the response (including text that isn't related to the value * of FeatureTypes). *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param featureTypes

* A list of the types of analysis to perform. Add TABLES to the * list to return information about the tables that are detected * in the input document. Add FORMS to return detected form data. * Add SIGNATURES to return the locations of detected signatures. * To perform both forms and table analysis, add TABLES and FORMS * to FeatureTypes. To detect signatures within form * data and table data, add SIGNATURES to either TABLES or FORMS. * All lines and words detected in the document are included in * the response (including text that isn't related to the value * of FeatureTypes). *

* @return A reference to this updated object so that method calls can be * chained together. */ public AnalyzeDocumentRequest withFeatureTypes(java.util.Collection featureTypes) { setFeatureTypes(featureTypes); return this; } /** *

* Sets the configuration for the human in the loop workflow for analyzing * documents. *

* * @return

* Sets the configuration for the human in the loop workflow for * analyzing documents. *

*/ public HumanLoopConfig getHumanLoopConfig() { return humanLoopConfig; } /** *

* Sets the configuration for the human in the loop workflow for analyzing * documents. *

* * @param humanLoopConfig

* Sets the configuration for the human in the loop workflow for * analyzing documents. *

*/ public void setHumanLoopConfig(HumanLoopConfig humanLoopConfig) { this.humanLoopConfig = humanLoopConfig; } /** *

* Sets the configuration for the human in the loop workflow for analyzing * documents. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param humanLoopConfig

* Sets the configuration for the human in the loop workflow for * analyzing documents. *

* @return A reference to this updated object so that method calls can be * chained together. */ public AnalyzeDocumentRequest withHumanLoopConfig(HumanLoopConfig humanLoopConfig) { this.humanLoopConfig = humanLoopConfig; return this; } /** *

* Contains Queries and the alias for those Queries, as determined by the * input. *

* * @return

* Contains Queries and the alias for those Queries, as determined * by the input. *

*/ public QueriesConfig getQueriesConfig() { return queriesConfig; } /** *

* Contains Queries and the alias for those Queries, as determined by the * input. *

* * @param queriesConfig

* Contains Queries and the alias for those Queries, as * determined by the input. *

*/ public void setQueriesConfig(QueriesConfig queriesConfig) { this.queriesConfig = queriesConfig; } /** *

* Contains Queries and the alias for those Queries, as determined by the * input. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param queriesConfig

* Contains Queries and the alias for those Queries, as * determined by the input. *

* @return A reference to this updated object so that method calls can be * chained together. */ public AnalyzeDocumentRequest withQueriesConfig(QueriesConfig queriesConfig) { this.queriesConfig = queriesConfig; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getDocument() != null) sb.append("Document: " + getDocument() + ","); if (getFeatureTypes() != null) sb.append("FeatureTypes: " + getFeatureTypes() + ","); if (getHumanLoopConfig() != null) sb.append("HumanLoopConfig: " + getHumanLoopConfig() + ","); if (getQueriesConfig() != null) sb.append("QueriesConfig: " + getQueriesConfig()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDocument() == null) ? 0 : getDocument().hashCode()); hashCode = prime * hashCode + ((getFeatureTypes() == null) ? 0 : getFeatureTypes().hashCode()); hashCode = prime * hashCode + ((getHumanLoopConfig() == null) ? 0 : getHumanLoopConfig().hashCode()); hashCode = prime * hashCode + ((getQueriesConfig() == null) ? 0 : getQueriesConfig().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AnalyzeDocumentRequest == false) return false; AnalyzeDocumentRequest other = (AnalyzeDocumentRequest) obj; if (other.getDocument() == null ^ this.getDocument() == null) return false; if (other.getDocument() != null && other.getDocument().equals(this.getDocument()) == false) return false; if (other.getFeatureTypes() == null ^ this.getFeatureTypes() == null) return false; if (other.getFeatureTypes() != null && other.getFeatureTypes().equals(this.getFeatureTypes()) == false) return false; if (other.getHumanLoopConfig() == null ^ this.getHumanLoopConfig() == null) return false; if (other.getHumanLoopConfig() != null && other.getHumanLoopConfig().equals(this.getHumanLoopConfig()) == false) return false; if (other.getQueriesConfig() == null ^ this.getQueriesConfig() == null) return false; if (other.getQueriesConfig() != null && other.getQueriesConfig().equals(this.getQueriesConfig()) == false) return false; return true; } }