/* * 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; /** *

* The structure holding all the information returned by AnalyzeExpense *

*/ public class ExpenseDocument implements Serializable { /** *

* Denotes which invoice or receipt in the document the information is * coming from. First document will be 1, the second 2, and so on. *

*

* Constraints:
* Range: 0 -
*/ private Integer expenseIndex; /** *

* Any information found outside of a table by Amazon Textract. *

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

* Information detected on each table of a document, seperated into * LineItems. *

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

* This is a block object, the same as reported when DetectDocumentText is * run on a document. It provides word level recognition of text. *

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

* Denotes which invoice or receipt in the document the information is * coming from. First document will be 1, the second 2, and so on. *

*

* Constraints:
* Range: 0 -
* * @return

* Denotes which invoice or receipt in the document the information * is coming from. First document will be 1, the second 2, and so * on. *

*/ public Integer getExpenseIndex() { return expenseIndex; } /** *

* Denotes which invoice or receipt in the document the information is * coming from. First document will be 1, the second 2, and so on. *

*

* Constraints:
* Range: 0 -
* * @param expenseIndex

* Denotes which invoice or receipt in the document the * information is coming from. First document will be 1, the * second 2, and so on. *

*/ public void setExpenseIndex(Integer expenseIndex) { this.expenseIndex = expenseIndex; } /** *

* Denotes which invoice or receipt in the document the information is * coming from. First document will be 1, the second 2, and so on. *

*

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

* Constraints:
* Range: 0 -
* * @param expenseIndex

* Denotes which invoice or receipt in the document the * information is coming from. First document will be 1, the * second 2, and so on. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseDocument withExpenseIndex(Integer expenseIndex) { this.expenseIndex = expenseIndex; return this; } /** *

* Any information found outside of a table by Amazon Textract. *

* * @return

* Any information found outside of a table by Amazon Textract. *

*/ public java.util.List getSummaryFields() { return summaryFields; } /** *

* Any information found outside of a table by Amazon Textract. *

* * @param summaryFields

* Any information found outside of a table by Amazon Textract. *

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

* Any information found outside of a table by Amazon Textract. *

*

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

* Any information found outside of a table by Amazon Textract. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseDocument withSummaryFields(ExpenseField... summaryFields) { if (getSummaryFields() == null) { this.summaryFields = new java.util.ArrayList(summaryFields.length); } for (ExpenseField value : summaryFields) { this.summaryFields.add(value); } return this; } /** *

* Any information found outside of a table by Amazon Textract. *

*

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

* Any information found outside of a table by Amazon Textract. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseDocument withSummaryFields(java.util.Collection summaryFields) { setSummaryFields(summaryFields); return this; } /** *

* Information detected on each table of a document, seperated into * LineItems. *

* * @return

* Information detected on each table of a document, seperated into * LineItems. *

*/ public java.util.List getLineItemGroups() { return lineItemGroups; } /** *

* Information detected on each table of a document, seperated into * LineItems. *

* * @param lineItemGroups

* Information detected on each table of a document, seperated * into LineItems. *

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

* Information detected on each table of a document, seperated into * LineItems. *

*

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

* Information detected on each table of a document, seperated * into LineItems. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseDocument withLineItemGroups(LineItemGroup... lineItemGroups) { if (getLineItemGroups() == null) { this.lineItemGroups = new java.util.ArrayList(lineItemGroups.length); } for (LineItemGroup value : lineItemGroups) { this.lineItemGroups.add(value); } return this; } /** *

* Information detected on each table of a document, seperated into * LineItems. *

*

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

* Information detected on each table of a document, seperated * into LineItems. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseDocument withLineItemGroups(java.util.Collection lineItemGroups) { setLineItemGroups(lineItemGroups); return this; } /** *

* This is a block object, the same as reported when DetectDocumentText is * run on a document. It provides word level recognition of text. *

* * @return

* This is a block object, the same as reported when * DetectDocumentText is run on a document. It provides word level * recognition of text. *

*/ public java.util.List getBlocks() { return blocks; } /** *

* This is a block object, the same as reported when DetectDocumentText is * run on a document. It provides word level recognition of text. *

* * @param blocks

* This is a block object, the same as reported when * DetectDocumentText is run on a document. It provides word * level recognition of text. *

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

* This is a block object, the same as reported when DetectDocumentText is * run on a document. It provides word level recognition of text. *

*

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

* This is a block object, the same as reported when * DetectDocumentText is run on a document. It provides word * level recognition of text. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseDocument withBlocks(Block... blocks) { if (getBlocks() == null) { this.blocks = new java.util.ArrayList(blocks.length); } for (Block value : blocks) { this.blocks.add(value); } return this; } /** *

* This is a block object, the same as reported when DetectDocumentText is * run on a document. It provides word level recognition of text. *

*

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

* This is a block object, the same as reported when * DetectDocumentText is run on a document. It provides word * level recognition of text. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseDocument withBlocks(java.util.Collection blocks) { setBlocks(blocks); 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 (getExpenseIndex() != null) sb.append("ExpenseIndex: " + getExpenseIndex() + ","); if (getSummaryFields() != null) sb.append("SummaryFields: " + getSummaryFields() + ","); if (getLineItemGroups() != null) sb.append("LineItemGroups: " + getLineItemGroups() + ","); if (getBlocks() != null) sb.append("Blocks: " + getBlocks()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getExpenseIndex() == null) ? 0 : getExpenseIndex().hashCode()); hashCode = prime * hashCode + ((getSummaryFields() == null) ? 0 : getSummaryFields().hashCode()); hashCode = prime * hashCode + ((getLineItemGroups() == null) ? 0 : getLineItemGroups().hashCode()); hashCode = prime * hashCode + ((getBlocks() == null) ? 0 : getBlocks().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ExpenseDocument == false) return false; ExpenseDocument other = (ExpenseDocument) obj; if (other.getExpenseIndex() == null ^ this.getExpenseIndex() == null) return false; if (other.getExpenseIndex() != null && other.getExpenseIndex().equals(this.getExpenseIndex()) == false) return false; if (other.getSummaryFields() == null ^ this.getSummaryFields() == null) return false; if (other.getSummaryFields() != null && other.getSummaryFields().equals(this.getSummaryFields()) == false) return false; if (other.getLineItemGroups() == null ^ this.getLineItemGroups() == null) return false; if (other.getLineItemGroups() != null && other.getLineItemGroups().equals(this.getLineItemGroups()) == false) return false; if (other.getBlocks() == null ^ this.getBlocks() == null) return false; if (other.getBlocks() != null && other.getBlocks().equals(this.getBlocks()) == false) return false; return true; } }