/* * 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 class assigned to a Page object detected in an input document. Contains * information regarding the predicted type/class of a document's page and the * page number that the Page object was detected on. *

*/ public class PageClassification implements Serializable { /** *

* The class, or document type, assigned to a detected Page object. The * class, or document type, assigned to a detected Page object. *

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

* The page number the value was detected on, relative to Amazon Textract's * starting position. *

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

* The class, or document type, assigned to a detected Page object. The * class, or document type, assigned to a detected Page object. *

* * @return

* The class, or document type, assigned to a detected Page object. * The class, or document type, assigned to a detected Page object. *

*/ public java.util.List getPageType() { return pageType; } /** *

* The class, or document type, assigned to a detected Page object. The * class, or document type, assigned to a detected Page object. *

* * @param pageType

* The class, or document type, assigned to a detected Page * object. The class, or document type, assigned to a detected * Page object. *

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

* The class, or document type, assigned to a detected Page object. The * class, or document type, assigned to a detected Page object. *

*

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

* The class, or document type, assigned to a detected Page * object. The class, or document type, assigned to a detected * Page object. *

* @return A reference to this updated object so that method calls can be * chained together. */ public PageClassification withPageType(Prediction... pageType) { if (getPageType() == null) { this.pageType = new java.util.ArrayList(pageType.length); } for (Prediction value : pageType) { this.pageType.add(value); } return this; } /** *

* The class, or document type, assigned to a detected Page object. The * class, or document type, assigned to a detected Page object. *

*

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

* The class, or document type, assigned to a detected Page * object. The class, or document type, assigned to a detected * Page object. *

* @return A reference to this updated object so that method calls can be * chained together. */ public PageClassification withPageType(java.util.Collection pageType) { setPageType(pageType); return this; } /** *

* The page number the value was detected on, relative to Amazon Textract's * starting position. *

* * @return

* The page number the value was detected on, relative to Amazon * Textract's starting position. *

*/ public java.util.List getPageNumber() { return pageNumber; } /** *

* The page number the value was detected on, relative to Amazon Textract's * starting position. *

* * @param pageNumber

* The page number the value was detected on, relative to Amazon * Textract's starting position. *

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

* The page number the value was detected on, relative to Amazon Textract's * starting position. *

*

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

* The page number the value was detected on, relative to Amazon * Textract's starting position. *

* @return A reference to this updated object so that method calls can be * chained together. */ public PageClassification withPageNumber(Prediction... pageNumber) { if (getPageNumber() == null) { this.pageNumber = new java.util.ArrayList(pageNumber.length); } for (Prediction value : pageNumber) { this.pageNumber.add(value); } return this; } /** *

* The page number the value was detected on, relative to Amazon Textract's * starting position. *

*

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

* The page number the value was detected on, relative to Amazon * Textract's starting position. *

* @return A reference to this updated object so that method calls can be * chained together. */ public PageClassification withPageNumber(java.util.Collection pageNumber) { setPageNumber(pageNumber); 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 (getPageType() != null) sb.append("PageType: " + getPageType() + ","); if (getPageNumber() != null) sb.append("PageNumber: " + getPageNumber()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPageType() == null) ? 0 : getPageType().hashCode()); hashCode = prime * hashCode + ((getPageNumber() == null) ? 0 : getPageNumber().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PageClassification == false) return false; PageClassification other = (PageClassification) obj; if (other.getPageType() == null ^ this.getPageType() == null) return false; if (other.getPageType() != null && other.getPageType().equals(this.getPageType()) == false) return false; if (other.getPageNumber() == null ^ this.getPageNumber() == null) return false; if (other.getPageNumber() != null && other.getPageNumber().equals(this.getPageNumber()) == false) return false; return true; } }