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

* Each query contains the question you want to ask in the Text and the alias * you want to associate. *

*/ public class Query implements Serializable { /** *

* Question that Amazon Textract will apply to the document. An example * would be "What is the customer's SSN?" *

*

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
*/ private String text; /** *

* Alias attached to the query, for ease of location. *

*

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
*/ private String alias; /** *

* Pages is a parameter that the user inputs to specify which pages to apply * a query to. The following is a list of rules for using this parameter. *

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

* Question that Amazon Textract will apply to the document. An example * would be "What is the customer's SSN?" *

*

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
* * @return

* Question that Amazon Textract will apply to the document. An * example would be "What is the customer's SSN?" *

*/ public String getText() { return text; } /** *

* Question that Amazon Textract will apply to the document. An example * would be "What is the customer's SSN?" *

*

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
* * @param text

* Question that Amazon Textract will apply to the document. An * example would be "What is the customer's SSN?" *

*/ public void setText(String text) { this.text = text; } /** *

* Question that Amazon Textract will apply to the document. An example * would be "What is the customer's SSN?" *

*

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

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
* * @param text

* Question that Amazon Textract will apply to the document. An * example would be "What is the customer's SSN?" *

* @return A reference to this updated object so that method calls can be * chained together. */ public Query withText(String text) { this.text = text; return this; } /** *

* Alias attached to the query, for ease of location. *

*

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
* * @return

* Alias attached to the query, for ease of location. *

*/ public String getAlias() { return alias; } /** *

* Alias attached to the query, for ease of location. *

*

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
* * @param alias

* Alias attached to the query, for ease of location. *

*/ public void setAlias(String alias) { this.alias = alias; } /** *

* Alias attached to the query, for ease of location. *

*

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

* Constraints:
* Length: 1 - 200
* Pattern: * ^[a-zA-Z0-9\s!"\#\$%'&\(\)\*\+\,\-\./:;=\?@\[\\\]\^_`\{\|\}~><]+$ *
* * @param alias

* Alias attached to the query, for ease of location. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Query withAlias(String alias) { this.alias = alias; return this; } /** *

* Pages is a parameter that the user inputs to specify which pages to apply * a query to. The following is a list of rules for using this parameter. *

* * * @return

* Pages is a parameter that the user inputs to specify which pages * to apply a query to. The following is a list of rules for using * this parameter. *

* */ public java.util.List getPages() { return pages; } /** *

* Pages is a parameter that the user inputs to specify which pages to apply * a query to. The following is a list of rules for using this parameter. *

* * * @param pages

* Pages is a parameter that the user inputs to specify which * pages to apply a query to. The following is a list of rules * for using this parameter. *

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

* Pages is a parameter that the user inputs to specify which pages to apply * a query to. The following is a list of rules for using this parameter. *

*
    *
  • *

    * If a page is not specified, it is set to ["1"] by default. *

    *
  • *
  • *

    * The following characters are allowed in the parameter's string: * 0 1 2 3 4 5 6 7 8 9 - *. No whitespace is allowed. *

    *
  • *
  • *

    * When using * to indicate all pages, it must be the only element in the * list. *

    *
  • *
  • *

    * You can use page intervals, such as [“1-3”, “1-1”, “4-*”]. * Where * indicates last page of document. *

    *
  • *
  • *

    * Specified pages must be greater than 0 and less than or equal to the * number of pages in the document. *

    *
  • *
*

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

* Pages is a parameter that the user inputs to specify which * pages to apply a query to. The following is a list of rules * for using this parameter. *

*
    *
  • *

    * If a page is not specified, it is set to ["1"] by * default. *

    *
  • *
  • *

    * The following characters are allowed in the parameter's * string: 0 1 2 3 4 5 6 7 8 9 - *. No whitespace is * allowed. *

    *
  • *
  • *

    * When using * to indicate all pages, it must be the only * element in the list. *

    *
  • *
  • *

    * You can use page intervals, such as * [“1-3”, “1-1”, “4-*”]. Where * * indicates last page of document. *

    *
  • *
  • *

    * Specified pages must be greater than 0 and less than or equal * to the number of pages in the document. *

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

* Pages is a parameter that the user inputs to specify which pages to apply * a query to. The following is a list of rules for using this parameter. *

*
    *
  • *

    * If a page is not specified, it is set to ["1"] by default. *

    *
  • *
  • *

    * The following characters are allowed in the parameter's string: * 0 1 2 3 4 5 6 7 8 9 - *. No whitespace is allowed. *

    *
  • *
  • *

    * When using * to indicate all pages, it must be the only element in the * list. *

    *
  • *
  • *

    * You can use page intervals, such as [“1-3”, “1-1”, “4-*”]. * Where * indicates last page of document. *

    *
  • *
  • *

    * Specified pages must be greater than 0 and less than or equal to the * number of pages in the document. *

    *
  • *
*

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

* Pages is a parameter that the user inputs to specify which * pages to apply a query to. The following is a list of rules * for using this parameter. *

*
    *
  • *

    * If a page is not specified, it is set to ["1"] by * default. *

    *
  • *
  • *

    * The following characters are allowed in the parameter's * string: 0 1 2 3 4 5 6 7 8 9 - *. No whitespace is * allowed. *

    *
  • *
  • *

    * When using * to indicate all pages, it must be the only * element in the list. *

    *
  • *
  • *

    * You can use page intervals, such as * [“1-3”, “1-1”, “4-*”]. Where * * indicates last page of document. *

    *
  • *
  • *

    * Specified pages must be greater than 0 and less than or equal * to the number of pages in the document. *

    *
  • *
* @return A reference to this updated object so that method calls can be * chained together. */ public Query withPages(java.util.Collection pages) { setPages(pages); 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 (getText() != null) sb.append("Text: " + getText() + ","); if (getAlias() != null) sb.append("Alias: " + getAlias() + ","); if (getPages() != null) sb.append("Pages: " + getPages()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getText() == null) ? 0 : getText().hashCode()); hashCode = prime * hashCode + ((getAlias() == null) ? 0 : getAlias().hashCode()); hashCode = prime * hashCode + ((getPages() == null) ? 0 : getPages().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Query == false) return false; Query other = (Query) obj; if (other.getText() == null ^ this.getText() == null) return false; if (other.getText() != null && other.getText().equals(this.getText()) == false) return false; if (other.getAlias() == null ^ this.getAlias() == null) return false; if (other.getAlias() != null && other.getAlias().equals(this.getAlias()) == false) return false; if (other.getPages() == null ^ this.getPages() == null) return false; if (other.getPages() != null && other.getPages().equals(this.getPages()) == false) return false; return true; } }