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

* Breakdown of detected information, seperated into the catagories Type, * LabelDetection, and ValueDetection *

*/ public class ExpenseField implements Serializable { /** *

* The implied label of a detected element. Present alongside LabelDetection * for explicit elements. *

*/ private ExpenseType type; /** *

* The explicitly stated label of a detected element. *

*/ private ExpenseDetection labelDetection; /** *

* The value of a detected element. Present in explicit and implicit * elements. *

*/ private ExpenseDetection valueDetection; /** *

* The page number the value was detected on. *

*

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

* Shows the kind of currency, both the code and confidence associated with * any monatary value detected. *

*/ private ExpenseCurrency currency; /** *

* Shows which group a response object belongs to, such as whether an * address line belongs to the vendor's address or the recipent's address. *

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

* The implied label of a detected element. Present alongside LabelDetection * for explicit elements. *

* * @return

* The implied label of a detected element. Present alongside * LabelDetection for explicit elements. *

*/ public ExpenseType getType() { return type; } /** *

* The implied label of a detected element. Present alongside LabelDetection * for explicit elements. *

* * @param type

* The implied label of a detected element. Present alongside * LabelDetection for explicit elements. *

*/ public void setType(ExpenseType type) { this.type = type; } /** *

* The implied label of a detected element. Present alongside LabelDetection * for explicit elements. *

*

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

* The implied label of a detected element. Present alongside * LabelDetection for explicit elements. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseField withType(ExpenseType type) { this.type = type; return this; } /** *

* The explicitly stated label of a detected element. *

* * @return

* The explicitly stated label of a detected element. *

*/ public ExpenseDetection getLabelDetection() { return labelDetection; } /** *

* The explicitly stated label of a detected element. *

* * @param labelDetection

* The explicitly stated label of a detected element. *

*/ public void setLabelDetection(ExpenseDetection labelDetection) { this.labelDetection = labelDetection; } /** *

* The explicitly stated label of a detected element. *

*

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

* The explicitly stated label of a detected element. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseField withLabelDetection(ExpenseDetection labelDetection) { this.labelDetection = labelDetection; return this; } /** *

* The value of a detected element. Present in explicit and implicit * elements. *

* * @return

* The value of a detected element. Present in explicit and implicit * elements. *

*/ public ExpenseDetection getValueDetection() { return valueDetection; } /** *

* The value of a detected element. Present in explicit and implicit * elements. *

* * @param valueDetection

* The value of a detected element. Present in explicit and * implicit elements. *

*/ public void setValueDetection(ExpenseDetection valueDetection) { this.valueDetection = valueDetection; } /** *

* The value of a detected element. Present in explicit and implicit * elements. *

*

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

* The value of a detected element. Present in explicit and * implicit elements. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseField withValueDetection(ExpenseDetection valueDetection) { this.valueDetection = valueDetection; return this; } /** *

* The page number the value was detected on. *

*

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

* The page number the value was detected on. *

*/ public Integer getPageNumber() { return pageNumber; } /** *

* The page number the value was detected on. *

*

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

* The page number the value was detected on. *

*/ public void setPageNumber(Integer pageNumber) { this.pageNumber = pageNumber; } /** *

* The page number the value was detected on. *

*

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

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

* The page number the value was detected on. *

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

* Shows the kind of currency, both the code and confidence associated with * any monatary value detected. *

* * @return

* Shows the kind of currency, both the code and confidence * associated with any monatary value detected. *

*/ public ExpenseCurrency getCurrency() { return currency; } /** *

* Shows the kind of currency, both the code and confidence associated with * any monatary value detected. *

* * @param currency

* Shows the kind of currency, both the code and confidence * associated with any monatary value detected. *

*/ public void setCurrency(ExpenseCurrency currency) { this.currency = currency; } /** *

* Shows the kind of currency, both the code and confidence associated with * any monatary value detected. *

*

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

* Shows the kind of currency, both the code and confidence * associated with any monatary value detected. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseField withCurrency(ExpenseCurrency currency) { this.currency = currency; return this; } /** *

* Shows which group a response object belongs to, such as whether an * address line belongs to the vendor's address or the recipent's address. *

* * @return

* Shows which group a response object belongs to, such as whether * an address line belongs to the vendor's address or the recipent's * address. *

*/ public java.util.List getGroupProperties() { return groupProperties; } /** *

* Shows which group a response object belongs to, such as whether an * address line belongs to the vendor's address or the recipent's address. *

* * @param groupProperties

* Shows which group a response object belongs to, such as * whether an address line belongs to the vendor's address or the * recipent's address. *

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

* Shows which group a response object belongs to, such as whether an * address line belongs to the vendor's address or the recipent's address. *

*

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

* Shows which group a response object belongs to, such as * whether an address line belongs to the vendor's address or the * recipent's address. *

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

* Shows which group a response object belongs to, such as whether an * address line belongs to the vendor's address or the recipent's address. *

*

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

* Shows which group a response object belongs to, such as * whether an address line belongs to the vendor's address or the * recipent's address. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ExpenseField withGroupProperties( java.util.Collection groupProperties) { setGroupProperties(groupProperties); 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 (getType() != null) sb.append("Type: " + getType() + ","); if (getLabelDetection() != null) sb.append("LabelDetection: " + getLabelDetection() + ","); if (getValueDetection() != null) sb.append("ValueDetection: " + getValueDetection() + ","); if (getPageNumber() != null) sb.append("PageNumber: " + getPageNumber() + ","); if (getCurrency() != null) sb.append("Currency: " + getCurrency() + ","); if (getGroupProperties() != null) sb.append("GroupProperties: " + getGroupProperties()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getLabelDetection() == null) ? 0 : getLabelDetection().hashCode()); hashCode = prime * hashCode + ((getValueDetection() == null) ? 0 : getValueDetection().hashCode()); hashCode = prime * hashCode + ((getPageNumber() == null) ? 0 : getPageNumber().hashCode()); hashCode = prime * hashCode + ((getCurrency() == null) ? 0 : getCurrency().hashCode()); hashCode = prime * hashCode + ((getGroupProperties() == null) ? 0 : getGroupProperties().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ExpenseField == false) return false; ExpenseField other = (ExpenseField) obj; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getLabelDetection() == null ^ this.getLabelDetection() == null) return false; if (other.getLabelDetection() != null && other.getLabelDetection().equals(this.getLabelDetection()) == false) return false; if (other.getValueDetection() == null ^ this.getValueDetection() == null) return false; if (other.getValueDetection() != null && other.getValueDetection().equals(this.getValueDetection()) == false) return false; if (other.getPageNumber() == null ^ this.getPageNumber() == null) return false; if (other.getPageNumber() != null && other.getPageNumber().equals(this.getPageNumber()) == false) return false; if (other.getCurrency() == null ^ this.getCurrency() == null) return false; if (other.getCurrency() != null && other.getCurrency().equals(this.getCurrency()) == false) return false; if (other.getGroupProperties() == null ^ this.getGroupProperties() == null) return false; if (other.getGroupProperties() != null && other.getGroupProperties().equals(this.getGroupProperties()) == false) return false; return true; } }