software.amazon.awssdk.services.textract.model.Block Maven / Gradle / Ivy
Show all versions of textract Show documentation
/*
* Copyright 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 software.amazon.awssdk.services.textract.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A Block
represents items that are recognized in a document within a group of pixels close to each other.
* The information returned in a Block
object depends on the type of operation. In text detection for
* documents (for example DetectDocumentText), you get information about the detected words and lines of text. In
* text analysis (for example AnalyzeDocument), you can also get information about the fields, tables, and
* selection elements that are detected in the document.
*
*
* An array of Block
objects is returned by both synchronous and asynchronous operations. In synchronous
* operations, such as DetectDocumentText, the array of Block
objects is the entire set of results.
* In asynchronous operations, such as GetDocumentAnalysis, the array is returned over one or more responses.
*
*
* For more information, see How Amazon
* Textract Works.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Block implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BLOCK_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BlockType").getter(getter(Block::blockTypeAsString)).setter(setter(Builder::blockType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BlockType").build()).build();
private static final SdkField CONFIDENCE_FIELD = SdkField. builder(MarshallingType.FLOAT)
.memberName("Confidence").getter(getter(Block::confidence)).setter(setter(Builder::confidence))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Confidence").build()).build();
private static final SdkField TEXT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Text")
.getter(getter(Block::text)).setter(setter(Builder::text))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Text").build()).build();
private static final SdkField TEXT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TextType").getter(getter(Block::textTypeAsString)).setter(setter(Builder::textType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TextType").build()).build();
private static final SdkField ROW_INDEX_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("RowIndex").getter(getter(Block::rowIndex)).setter(setter(Builder::rowIndex))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RowIndex").build()).build();
private static final SdkField COLUMN_INDEX_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ColumnIndex").getter(getter(Block::columnIndex)).setter(setter(Builder::columnIndex))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ColumnIndex").build()).build();
private static final SdkField ROW_SPAN_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("RowSpan").getter(getter(Block::rowSpan)).setter(setter(Builder::rowSpan))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RowSpan").build()).build();
private static final SdkField COLUMN_SPAN_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ColumnSpan").getter(getter(Block::columnSpan)).setter(setter(Builder::columnSpan))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ColumnSpan").build()).build();
private static final SdkField GEOMETRY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Geometry").getter(getter(Block::geometry)).setter(setter(Builder::geometry))
.constructor(Geometry::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Geometry").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(Block::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField> RELATIONSHIPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Relationships")
.getter(getter(Block::relationships))
.setter(setter(Builder::relationships))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Relationships").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Relationship::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> ENTITY_TYPES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("EntityTypes")
.getter(getter(Block::entityTypesAsStrings))
.setter(setter(Builder::entityTypesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntityTypes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField SELECTION_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SelectionStatus").getter(getter(Block::selectionStatusAsString))
.setter(setter(Builder::selectionStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SelectionStatus").build()).build();
private static final SdkField PAGE_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Page")
.getter(getter(Block::page)).setter(setter(Builder::page))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Page").build()).build();
private static final SdkField QUERY_FIELD = SdkField. builder(MarshallingType.SDK_POJO).memberName("Query")
.getter(getter(Block::query)).setter(setter(Builder::query)).constructor(Query::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Query").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BLOCK_TYPE_FIELD,
CONFIDENCE_FIELD, TEXT_FIELD, TEXT_TYPE_FIELD, ROW_INDEX_FIELD, COLUMN_INDEX_FIELD, ROW_SPAN_FIELD,
COLUMN_SPAN_FIELD, GEOMETRY_FIELD, ID_FIELD, RELATIONSHIPS_FIELD, ENTITY_TYPES_FIELD, SELECTION_STATUS_FIELD,
PAGE_FIELD, QUERY_FIELD));
private static final long serialVersionUID = 1L;
private final String blockType;
private final Float confidence;
private final String text;
private final String textType;
private final Integer rowIndex;
private final Integer columnIndex;
private final Integer rowSpan;
private final Integer columnSpan;
private final Geometry geometry;
private final String id;
private final List relationships;
private final List entityTypes;
private final String selectionStatus;
private final Integer page;
private final Query query;
private Block(BuilderImpl builder) {
this.blockType = builder.blockType;
this.confidence = builder.confidence;
this.text = builder.text;
this.textType = builder.textType;
this.rowIndex = builder.rowIndex;
this.columnIndex = builder.columnIndex;
this.rowSpan = builder.rowSpan;
this.columnSpan = builder.columnSpan;
this.geometry = builder.geometry;
this.id = builder.id;
this.relationships = builder.relationships;
this.entityTypes = builder.entityTypes;
this.selectionStatus = builder.selectionStatus;
this.page = builder.page;
this.query = builder.query;
}
/**
*
* The type of text item that's recognized. In operations for text detection, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of the LINE Block
objects that are detected on a document page.
*
*
* -
*
* WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that
* aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
*
*
* In text analysis operations, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of child Block
objects that are detected on a document page.
*
*
* -
*
* KEY_VALUE_SET - Stores the KEY and VALUE Block
objects for linked text that's detected on a
* document page. Use the EntityType
field to determine if a KEY_VALUE_SET object is a KEY
* Block
object or a VALUE Block
object.
*
*
* -
*
* WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters
* that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
* -
*
* TABLE - A table that's detected on a document page. A table is grid-based information with two or more
* rows or columns, with a cell span of one row and one column each.
*
*
* -
*
* TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or
* embedded as the first row of a table.
*
*
* -
*
* TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a
* table or embedded as the last row of a table.
*
*
* -
*
* CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the
* cell.
*
*
* -
*
* MERGED_CELL - A cell in a table whose content spans more than one row or column. The
* Relationships
array for this cell contain data from individual cells.
*
*
* -
*
* SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's
* detected on a document page. Use the value of SelectionStatus
to determine the status of the
* selection element.
*
*
* -
*
* SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned
* as part of a Key-Value pair or a detected cell.
*
*
* -
*
* QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it
* to its answer.
*
*
* -
*
* QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and
* ID for ease of locating in a response. Also contains location and confidence score.
*
*
*
*
* The following BlockTypes are only returned for Amazon Textract Layout.
*
*
* -
*
* LAYOUT_TITLE
- The main title of the document.
*
*
* -
*
* LAYOUT_HEADER
- Text located in the top margin of the document.
*
*
* -
*
* LAYOUT_FOOTER
- Text located in the bottom margin of the document.
*
*
* -
*
* LAYOUT_SECTION_HEADER
- The titles of sections within a document.
*
*
* -
*
* LAYOUT_PAGE_NUMBER
- The page number of the documents.
*
*
* -
*
* LAYOUT_LIST
- Any information grouped together in list form.
*
*
* -
*
* LAYOUT_FIGURE
- Indicates the location of an image in a document.
*
*
* -
*
* LAYOUT_TABLE
- Indicates the location of a table in the document.
*
*
* -
*
* LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document.
*
*
* -
*
* LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #blockType} will
* return {@link BlockType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #blockTypeAsString}.
*
*
* @return The type of text item that's recognized. In operations for text detection, the following types are
* returned:
*
* -
*
* PAGE - Contains a list of the LINE Block
objects that are detected on a document
* page.
*
*
* -
*
* WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters
* that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
*
*
* In text analysis operations, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of child Block
objects that are detected on a document page.
*
*
* -
*
* KEY_VALUE_SET - Stores the KEY and VALUE Block
objects for linked text that's
* detected on a document page. Use the EntityType
field to determine if a KEY_VALUE_SET object
* is a KEY Block
object or a VALUE Block
object.
*
*
* -
*
* WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script
* characters that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
* -
*
* TABLE - A table that's detected on a document page. A table is grid-based information with two or
* more rows or columns, with a cell span of one row and one column each.
*
*
* -
*
* TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or
* embedded as the first row of a table.
*
*
* -
*
* TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text
* below a table or embedded as the last row of a table.
*
*
* -
*
* CELL - A cell within a detected table. The cell is the parent of the block that contains the text
* in the cell.
*
*
* -
*
* MERGED_CELL - A cell in a table whose content spans more than one row or column. The
* Relationships
array for this cell contain data from individual cells.
*
*
* -
*
* SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box
* that's detected on a document page. Use the value of SelectionStatus
to determine the status
* of the selection element.
*
*
* -
*
* SIGNATURE - The location and confidence score of a signature detected on a document page. Can be
* returned as part of a Key-Value pair or a detected cell.
*
*
* -
*
* QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that
* attaches it to its answer.
*
*
* -
*
* QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an
* alias and ID for ease of locating in a response. Also contains location and confidence score.
*
*
*
*
* The following BlockTypes are only returned for Amazon Textract Layout.
*
*
* -
*
* LAYOUT_TITLE
- The main title of the document.
*
*
* -
*
* LAYOUT_HEADER
- Text located in the top margin of the document.
*
*
* -
*
* LAYOUT_FOOTER
- Text located in the bottom margin of the document.
*
*
* -
*
* LAYOUT_SECTION_HEADER
- The titles of sections within a document.
*
*
* -
*
* LAYOUT_PAGE_NUMBER
- The page number of the documents.
*
*
* -
*
* LAYOUT_LIST
- Any information grouped together in list form.
*
*
* -
*
* LAYOUT_FIGURE
- Indicates the location of an image in a document.
*
*
* -
*
* LAYOUT_TABLE
- Indicates the location of a table in the document.
*
*
* -
*
* LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document.
*
*
* -
*
* LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
*
*
* @see BlockType
*/
public final BlockType blockType() {
return BlockType.fromValue(blockType);
}
/**
*
* The type of text item that's recognized. In operations for text detection, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of the LINE Block
objects that are detected on a document page.
*
*
* -
*
* WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that
* aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
*
*
* In text analysis operations, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of child Block
objects that are detected on a document page.
*
*
* -
*
* KEY_VALUE_SET - Stores the KEY and VALUE Block
objects for linked text that's detected on a
* document page. Use the EntityType
field to determine if a KEY_VALUE_SET object is a KEY
* Block
object or a VALUE Block
object.
*
*
* -
*
* WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters
* that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
* -
*
* TABLE - A table that's detected on a document page. A table is grid-based information with two or more
* rows or columns, with a cell span of one row and one column each.
*
*
* -
*
* TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or
* embedded as the first row of a table.
*
*
* -
*
* TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a
* table or embedded as the last row of a table.
*
*
* -
*
* CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the
* cell.
*
*
* -
*
* MERGED_CELL - A cell in a table whose content spans more than one row or column. The
* Relationships
array for this cell contain data from individual cells.
*
*
* -
*
* SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's
* detected on a document page. Use the value of SelectionStatus
to determine the status of the
* selection element.
*
*
* -
*
* SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned
* as part of a Key-Value pair or a detected cell.
*
*
* -
*
* QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it
* to its answer.
*
*
* -
*
* QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and
* ID for ease of locating in a response. Also contains location and confidence score.
*
*
*
*
* The following BlockTypes are only returned for Amazon Textract Layout.
*
*
* -
*
* LAYOUT_TITLE
- The main title of the document.
*
*
* -
*
* LAYOUT_HEADER
- Text located in the top margin of the document.
*
*
* -
*
* LAYOUT_FOOTER
- Text located in the bottom margin of the document.
*
*
* -
*
* LAYOUT_SECTION_HEADER
- The titles of sections within a document.
*
*
* -
*
* LAYOUT_PAGE_NUMBER
- The page number of the documents.
*
*
* -
*
* LAYOUT_LIST
- Any information grouped together in list form.
*
*
* -
*
* LAYOUT_FIGURE
- Indicates the location of an image in a document.
*
*
* -
*
* LAYOUT_TABLE
- Indicates the location of a table in the document.
*
*
* -
*
* LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document.
*
*
* -
*
* LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #blockType} will
* return {@link BlockType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #blockTypeAsString}.
*
*
* @return The type of text item that's recognized. In operations for text detection, the following types are
* returned:
*
* -
*
* PAGE - Contains a list of the LINE Block
objects that are detected on a document
* page.
*
*
* -
*
* WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters
* that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
*
*
* In text analysis operations, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of child Block
objects that are detected on a document page.
*
*
* -
*
* KEY_VALUE_SET - Stores the KEY and VALUE Block
objects for linked text that's
* detected on a document page. Use the EntityType
field to determine if a KEY_VALUE_SET object
* is a KEY Block
object or a VALUE Block
object.
*
*
* -
*
* WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script
* characters that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
* -
*
* TABLE - A table that's detected on a document page. A table is grid-based information with two or
* more rows or columns, with a cell span of one row and one column each.
*
*
* -
*
* TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or
* embedded as the first row of a table.
*
*
* -
*
* TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text
* below a table or embedded as the last row of a table.
*
*
* -
*
* CELL - A cell within a detected table. The cell is the parent of the block that contains the text
* in the cell.
*
*
* -
*
* MERGED_CELL - A cell in a table whose content spans more than one row or column. The
* Relationships
array for this cell contain data from individual cells.
*
*
* -
*
* SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box
* that's detected on a document page. Use the value of SelectionStatus
to determine the status
* of the selection element.
*
*
* -
*
* SIGNATURE - The location and confidence score of a signature detected on a document page. Can be
* returned as part of a Key-Value pair or a detected cell.
*
*
* -
*
* QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that
* attaches it to its answer.
*
*
* -
*
* QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an
* alias and ID for ease of locating in a response. Also contains location and confidence score.
*
*
*
*
* The following BlockTypes are only returned for Amazon Textract Layout.
*
*
* -
*
* LAYOUT_TITLE
- The main title of the document.
*
*
* -
*
* LAYOUT_HEADER
- Text located in the top margin of the document.
*
*
* -
*
* LAYOUT_FOOTER
- Text located in the bottom margin of the document.
*
*
* -
*
* LAYOUT_SECTION_HEADER
- The titles of sections within a document.
*
*
* -
*
* LAYOUT_PAGE_NUMBER
- The page number of the documents.
*
*
* -
*
* LAYOUT_LIST
- Any information grouped together in list form.
*
*
* -
*
* LAYOUT_FIGURE
- Indicates the location of an image in a document.
*
*
* -
*
* LAYOUT_TABLE
- Indicates the location of a table in the document.
*
*
* -
*
* LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document.
*
*
* -
*
* LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
*
*
* @see BlockType
*/
public final String blockTypeAsString() {
return blockType;
}
/**
*
* The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the
* geometry points around the recognized text.
*
*
* @return The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of
* the geometry points around the recognized text.
*/
public final Float confidence() {
return confidence;
}
/**
*
* The word or line of text that's recognized by Amazon Textract.
*
*
* @return The word or line of text that's recognized by Amazon Textract.
*/
public final String text() {
return text;
}
/**
*
* The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #textType} will
* return {@link TextType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #textTypeAsString}.
*
*
* @return The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
* @see TextType
*/
public final TextType textType() {
return TextType.fromValue(textType);
}
/**
*
* The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #textType} will
* return {@link TextType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #textTypeAsString}.
*
*
* @return The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
* @see TextType
*/
public final String textTypeAsString() {
return textType;
}
/**
*
* The row in which a table cell is located. The first row position is 1. RowIndex
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @return The row in which a table cell is located. The first row position is 1. RowIndex
isn't
* returned by DetectDocumentText
and GetDocumentTextDetection
.
*/
public final Integer rowIndex() {
return rowIndex;
}
/**
*
* The column in which a table cell appears. The first column position is 1. ColumnIndex
isn't returned
* by DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @return The column in which a table cell appears. The first column position is 1. ColumnIndex
isn't
* returned by DetectDocumentText
and GetDocumentTextDetection
.
*/
public final Integer columnIndex() {
return columnIndex;
}
/**
*
* The number of rows that a table cell spans. RowSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @return The number of rows that a table cell spans. RowSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
*/
public final Integer rowSpan() {
return rowSpan;
}
/**
*
* The number of columns that a table cell spans. ColumnSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @return The number of columns that a table cell spans. ColumnSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
*/
public final Integer columnSpan() {
return columnSpan;
}
/**
*
* The location of the recognized text on the image. It includes an axis-aligned, coarse bounding box that surrounds
* the text, and a finer-grain polygon for more accurate spatial information.
*
*
* @return The location of the recognized text on the image. It includes an axis-aligned, coarse bounding box that
* surrounds the text, and a finer-grain polygon for more accurate spatial information.
*/
public final Geometry geometry() {
return geometry;
}
/**
*
* The identifier for the recognized text. The identifier is only unique for a single operation.
*
*
* @return The identifier for the recognized text. The identifier is only unique for a single operation.
*/
public final String id() {
return id;
}
/**
* For responses, this returns true if the service returned a value for the Relationships property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasRelationships() {
return relationships != null && !(relationships instanceof SdkAutoConstructList);
}
/**
*
* A list of relationship objects that describe how blocks are related to each other. For example, a LINE block
* object contains a CHILD relationship type with the WORD blocks that make up the line of text. There aren't
* Relationship objects in the list for relationships that don't exist, such as when the current block has no child
* blocks.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasRelationships} method.
*
*
* @return A list of relationship objects that describe how blocks are related to each other. For example, a LINE
* block object contains a CHILD relationship type with the WORD blocks that make up the line of text. There
* aren't Relationship objects in the list for relationships that don't exist, such as when the current
* block has no child blocks.
*/
public final List relationships() {
return relationships;
}
/**
*
* The type of entity.
*
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a
* cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to
* the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasEntityTypes} method.
*
*
* @return The type of entity.
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section
* title is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row
* corresponds to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*/
public final List entityTypes() {
return EntityTypesCopier.copyStringToEnum(entityTypes);
}
/**
* For responses, this returns true if the service returned a value for the EntityTypes property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasEntityTypes() {
return entityTypes != null && !(entityTypes instanceof SdkAutoConstructList);
}
/**
*
* The type of entity.
*
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a
* cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to
* the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasEntityTypes} method.
*
*
* @return The type of entity.
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section
* title is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row
* corresponds to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*/
public final List entityTypesAsStrings() {
return entityTypes;
}
/**
*
* The selection status of a selection element, such as an option button or check box.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #selectionStatus}
* will return {@link SelectionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #selectionStatusAsString}.
*
*
* @return The selection status of a selection element, such as an option button or check box.
* @see SelectionStatus
*/
public final SelectionStatus selectionStatus() {
return SelectionStatus.fromValue(selectionStatus);
}
/**
*
* The selection status of a selection element, such as an option button or check box.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #selectionStatus}
* will return {@link SelectionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #selectionStatusAsString}.
*
*
* @return The selection status of a selection element, such as an option button or check box.
* @see SelectionStatus
*/
public final String selectionStatusAsString() {
return selectionStatus;
}
/**
*
* The page on which a block was detected. Page
is returned by synchronous and asynchronous operations.
* Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned
* image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is
* considered a single-page document. This means that for scanned images the value of Page
is always 1.
*
*
* @return The page on which a block was detected. Page
is returned by synchronous and asynchronous
* operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF
* format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple
* document pages, is considered a single-page document. This means that for scanned images the value of
* Page
is always 1.
*/
public final Integer page() {
return page;
}
/**
*
*
* @return
*/
public final Query query() {
return query;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(blockTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(confidence());
hashCode = 31 * hashCode + Objects.hashCode(text());
hashCode = 31 * hashCode + Objects.hashCode(textTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(rowIndex());
hashCode = 31 * hashCode + Objects.hashCode(columnIndex());
hashCode = 31 * hashCode + Objects.hashCode(rowSpan());
hashCode = 31 * hashCode + Objects.hashCode(columnSpan());
hashCode = 31 * hashCode + Objects.hashCode(geometry());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(hasRelationships() ? relationships() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasEntityTypes() ? entityTypesAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(selectionStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(page());
hashCode = 31 * hashCode + Objects.hashCode(query());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Block)) {
return false;
}
Block other = (Block) obj;
return Objects.equals(blockTypeAsString(), other.blockTypeAsString()) && Objects.equals(confidence(), other.confidence())
&& Objects.equals(text(), other.text()) && Objects.equals(textTypeAsString(), other.textTypeAsString())
&& Objects.equals(rowIndex(), other.rowIndex()) && Objects.equals(columnIndex(), other.columnIndex())
&& Objects.equals(rowSpan(), other.rowSpan()) && Objects.equals(columnSpan(), other.columnSpan())
&& Objects.equals(geometry(), other.geometry()) && Objects.equals(id(), other.id())
&& hasRelationships() == other.hasRelationships() && Objects.equals(relationships(), other.relationships())
&& hasEntityTypes() == other.hasEntityTypes()
&& Objects.equals(entityTypesAsStrings(), other.entityTypesAsStrings())
&& Objects.equals(selectionStatusAsString(), other.selectionStatusAsString())
&& Objects.equals(page(), other.page()) && Objects.equals(query(), other.query());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("Block").add("BlockType", blockTypeAsString()).add("Confidence", confidence())
.add("Text", text()).add("TextType", textTypeAsString()).add("RowIndex", rowIndex())
.add("ColumnIndex", columnIndex()).add("RowSpan", rowSpan()).add("ColumnSpan", columnSpan())
.add("Geometry", geometry()).add("Id", id()).add("Relationships", hasRelationships() ? relationships() : null)
.add("EntityTypes", hasEntityTypes() ? entityTypesAsStrings() : null)
.add("SelectionStatus", selectionStatusAsString()).add("Page", page()).add("Query", query()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BlockType":
return Optional.ofNullable(clazz.cast(blockTypeAsString()));
case "Confidence":
return Optional.ofNullable(clazz.cast(confidence()));
case "Text":
return Optional.ofNullable(clazz.cast(text()));
case "TextType":
return Optional.ofNullable(clazz.cast(textTypeAsString()));
case "RowIndex":
return Optional.ofNullable(clazz.cast(rowIndex()));
case "ColumnIndex":
return Optional.ofNullable(clazz.cast(columnIndex()));
case "RowSpan":
return Optional.ofNullable(clazz.cast(rowSpan()));
case "ColumnSpan":
return Optional.ofNullable(clazz.cast(columnSpan()));
case "Geometry":
return Optional.ofNullable(clazz.cast(geometry()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Relationships":
return Optional.ofNullable(clazz.cast(relationships()));
case "EntityTypes":
return Optional.ofNullable(clazz.cast(entityTypesAsStrings()));
case "SelectionStatus":
return Optional.ofNullable(clazz.cast(selectionStatusAsString()));
case "Page":
return Optional.ofNullable(clazz.cast(page()));
case "Query":
return Optional.ofNullable(clazz.cast(query()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* -
*
* PAGE - Contains a list of the LINE Block
objects that are detected on a document
* page.
*
*
* -
*
* WORD - A word detected on a document page. A word is one or more ISO basic Latin script
* characters that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
*
*
* In text analysis operations, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of child Block
objects that are detected on a document
* page.
*
*
* -
*
* KEY_VALUE_SET - Stores the KEY and VALUE Block
objects for linked text that's
* detected on a document page. Use the EntityType
field to determine if a KEY_VALUE_SET
* object is a KEY Block
object or a VALUE Block
object.
*
*
* -
*
* WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script
* characters that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
* -
*
* TABLE - A table that's detected on a document page. A table is grid-based information with two
* or more rows or columns, with a cell span of one row and one column each.
*
*
* -
*
* TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table,
* or embedded as the first row of a table.
*
*
* -
*
* TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of
* text below a table or embedded as the last row of a table.
*
*
* -
*
* CELL - A cell within a detected table. The cell is the parent of the block that contains the
* text in the cell.
*
*
* -
*
* MERGED_CELL - A cell in a table whose content spans more than one row or column. The
* Relationships
array for this cell contain data from individual cells.
*
*
* -
*
* SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box
* that's detected on a document page. Use the value of SelectionStatus
to determine the
* status of the selection element.
*
*
* -
*
* SIGNATURE - The location and confidence score of a signature detected on a document page. Can
* be returned as part of a Key-Value pair or a detected cell.
*
*
* -
*
* QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that
* attaches it to its answer.
*
*
* -
*
* QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with
* an alias and ID for ease of locating in a response. Also contains location and confidence score.
*
*
*
*
* The following BlockTypes are only returned for Amazon Textract Layout.
*
*
* -
*
* LAYOUT_TITLE
- The main title of the document.
*
*
* -
*
* LAYOUT_HEADER
- Text located in the top margin of the document.
*
*
* -
*
* LAYOUT_FOOTER
- Text located in the bottom margin of the document.
*
*
* -
*
* LAYOUT_SECTION_HEADER
- The titles of sections within a document.
*
*
* -
*
* LAYOUT_PAGE_NUMBER
- The page number of the documents.
*
*
* -
*
* LAYOUT_LIST
- Any information grouped together in list form.
*
*
* -
*
* LAYOUT_FIGURE
- Indicates the location of an image in a document.
*
*
* -
*
* LAYOUT_TABLE
- Indicates the location of a table in the document.
*
*
* -
*
* LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document.
*
*
* -
*
* LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
*
*
* @see BlockType
* @return Returns a reference to this object so that method calls can be chained together.
* @see BlockType
*/
Builder blockType(String blockType);
/**
*
* The type of text item that's recognized. In operations for text detection, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of the LINE Block
objects that are detected on a document page.
*
*
* -
*
* WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters
* that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
*
*
* In text analysis operations, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of child Block
objects that are detected on a document page.
*
*
* -
*
* KEY_VALUE_SET - Stores the KEY and VALUE Block
objects for linked text that's detected on
* a document page. Use the EntityType
field to determine if a KEY_VALUE_SET object is a KEY
* Block
object or a VALUE Block
object.
*
*
* -
*
* WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script
* characters that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
* -
*
* TABLE - A table that's detected on a document page. A table is grid-based information with two or more
* rows or columns, with a cell span of one row and one column each.
*
*
* -
*
* TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or
* embedded as the first row of a table.
*
*
* -
*
* TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below
* a table or embedded as the last row of a table.
*
*
* -
*
* CELL - A cell within a detected table. The cell is the parent of the block that contains the text in
* the cell.
*
*
* -
*
* MERGED_CELL - A cell in a table whose content spans more than one row or column. The
* Relationships
array for this cell contain data from individual cells.
*
*
* -
*
* SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's
* detected on a document page. Use the value of SelectionStatus
to determine the status of the
* selection element.
*
*
* -
*
* SIGNATURE - The location and confidence score of a signature detected on a document page. Can be
* returned as part of a Key-Value pair or a detected cell.
*
*
* -
*
* QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches
* it to its answer.
*
*
* -
*
* QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias
* and ID for ease of locating in a response. Also contains location and confidence score.
*
*
*
*
* The following BlockTypes are only returned for Amazon Textract Layout.
*
*
* -
*
* LAYOUT_TITLE
- The main title of the document.
*
*
* -
*
* LAYOUT_HEADER
- Text located in the top margin of the document.
*
*
* -
*
* LAYOUT_FOOTER
- Text located in the bottom margin of the document.
*
*
* -
*
* LAYOUT_SECTION_HEADER
- The titles of sections within a document.
*
*
* -
*
* LAYOUT_PAGE_NUMBER
- The page number of the documents.
*
*
* -
*
* LAYOUT_LIST
- Any information grouped together in list form.
*
*
* -
*
* LAYOUT_FIGURE
- Indicates the location of an image in a document.
*
*
* -
*
* LAYOUT_TABLE
- Indicates the location of a table in the document.
*
*
* -
*
* LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document.
*
*
* -
*
* LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
*
*
*
*
* @param blockType
* The type of text item that's recognized. In operations for text detection, the following types are
* returned:
*
* -
*
* PAGE - Contains a list of the LINE Block
objects that are detected on a document
* page.
*
*
* -
*
* WORD - A word detected on a document page. A word is one or more ISO basic Latin script
* characters that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
*
*
* In text analysis operations, the following types are returned:
*
*
* -
*
* PAGE - Contains a list of child Block
objects that are detected on a document
* page.
*
*
* -
*
* KEY_VALUE_SET - Stores the KEY and VALUE Block
objects for linked text that's
* detected on a document page. Use the EntityType
field to determine if a KEY_VALUE_SET
* object is a KEY Block
object or a VALUE Block
object.
*
*
* -
*
* WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script
* characters that aren't separated by spaces.
*
*
* -
*
* LINE - A string of tab-delimited, contiguous words that are detected on a document page.
*
*
* -
*
* TABLE - A table that's detected on a document page. A table is grid-based information with two
* or more rows or columns, with a cell span of one row and one column each.
*
*
* -
*
* TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table,
* or embedded as the first row of a table.
*
*
* -
*
* TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of
* text below a table or embedded as the last row of a table.
*
*
* -
*
* CELL - A cell within a detected table. The cell is the parent of the block that contains the
* text in the cell.
*
*
* -
*
* MERGED_CELL - A cell in a table whose content spans more than one row or column. The
* Relationships
array for this cell contain data from individual cells.
*
*
* -
*
* SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box
* that's detected on a document page. Use the value of SelectionStatus
to determine the
* status of the selection element.
*
*
* -
*
* SIGNATURE - The location and confidence score of a signature detected on a document page. Can
* be returned as part of a Key-Value pair or a detected cell.
*
*
* -
*
* QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that
* attaches it to its answer.
*
*
* -
*
* QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with
* an alias and ID for ease of locating in a response. Also contains location and confidence score.
*
*
*
*
* The following BlockTypes are only returned for Amazon Textract Layout.
*
*
* -
*
* LAYOUT_TITLE
- The main title of the document.
*
*
* -
*
* LAYOUT_HEADER
- Text located in the top margin of the document.
*
*
* -
*
* LAYOUT_FOOTER
- Text located in the bottom margin of the document.
*
*
* -
*
* LAYOUT_SECTION_HEADER
- The titles of sections within a document.
*
*
* -
*
* LAYOUT_PAGE_NUMBER
- The page number of the documents.
*
*
* -
*
* LAYOUT_LIST
- Any information grouped together in list form.
*
*
* -
*
* LAYOUT_FIGURE
- Indicates the location of an image in a document.
*
*
* -
*
* LAYOUT_TABLE
- Indicates the location of a table in the document.
*
*
* -
*
* LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document.
*
*
* -
*
* LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
*
*
* @see BlockType
* @return Returns a reference to this object so that method calls can be chained together.
* @see BlockType
*/
Builder blockType(BlockType blockType);
/**
*
* The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the
* geometry points around the recognized text.
*
*
* @param confidence
* The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy
* of the geometry points around the recognized text.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder confidence(Float confidence);
/**
*
* The word or line of text that's recognized by Amazon Textract.
*
*
* @param text
* The word or line of text that's recognized by Amazon Textract.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder text(String text);
/**
*
* The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
*
*
* @param textType
* The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
* @see TextType
* @return Returns a reference to this object so that method calls can be chained together.
* @see TextType
*/
Builder textType(String textType);
/**
*
* The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
*
*
* @param textType
* The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
* @see TextType
* @return Returns a reference to this object so that method calls can be chained together.
* @see TextType
*/
Builder textType(TextType textType);
/**
*
* The row in which a table cell is located. The first row position is 1. RowIndex
isn't returned
* by DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @param rowIndex
* The row in which a table cell is located. The first row position is 1. RowIndex
isn't
* returned by DetectDocumentText
and GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder rowIndex(Integer rowIndex);
/**
*
* The column in which a table cell appears. The first column position is 1. ColumnIndex
isn't
* returned by DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @param columnIndex
* The column in which a table cell appears. The first column position is 1. ColumnIndex
* isn't returned by DetectDocumentText
and GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder columnIndex(Integer columnIndex);
/**
*
* The number of rows that a table cell spans. RowSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @param rowSpan
* The number of rows that a table cell spans. RowSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder rowSpan(Integer rowSpan);
/**
*
* The number of columns that a table cell spans. ColumnSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
*
*
* @param columnSpan
* The number of columns that a table cell spans. ColumnSpan
isn't returned by
* DetectDocumentText
and GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder columnSpan(Integer columnSpan);
/**
*
* The location of the recognized text on the image. It includes an axis-aligned, coarse bounding box that
* surrounds the text, and a finer-grain polygon for more accurate spatial information.
*
*
* @param geometry
* The location of the recognized text on the image. It includes an axis-aligned, coarse bounding box
* that surrounds the text, and a finer-grain polygon for more accurate spatial information.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder geometry(Geometry geometry);
/**
*
* The location of the recognized text on the image. It includes an axis-aligned, coarse bounding box that
* surrounds the text, and a finer-grain polygon for more accurate spatial information.
*
* This is a convenience method that creates an instance of the {@link Geometry.Builder} avoiding the need to
* create one manually via {@link Geometry#builder()}.
*
*
* When the {@link Consumer} completes, {@link Geometry.Builder#build()} is called immediately and its result is
* passed to {@link #geometry(Geometry)}.
*
* @param geometry
* a consumer that will call methods on {@link Geometry.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #geometry(Geometry)
*/
default Builder geometry(Consumer geometry) {
return geometry(Geometry.builder().applyMutation(geometry).build());
}
/**
*
* The identifier for the recognized text. The identifier is only unique for a single operation.
*
*
* @param id
* The identifier for the recognized text. The identifier is only unique for a single operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* A list of relationship objects that describe how blocks are related to each other. For example, a LINE block
* object contains a CHILD relationship type with the WORD blocks that make up the line of text. There aren't
* Relationship objects in the list for relationships that don't exist, such as when the current block has no
* child blocks.
*
*
* @param relationships
* A list of relationship objects that describe how blocks are related to each other. For example, a LINE
* block object contains a CHILD relationship type with the WORD blocks that make up the line of text.
* There aren't Relationship objects in the list for relationships that don't exist, such as when the
* current block has no child blocks.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder relationships(Collection relationships);
/**
*
* A list of relationship objects that describe how blocks are related to each other. For example, a LINE block
* object contains a CHILD relationship type with the WORD blocks that make up the line of text. There aren't
* Relationship objects in the list for relationships that don't exist, such as when the current block has no
* child blocks.
*
*
* @param relationships
* A list of relationship objects that describe how blocks are related to each other. For example, a LINE
* block object contains a CHILD relationship type with the WORD blocks that make up the line of text.
* There aren't Relationship objects in the list for relationships that don't exist, such as when the
* current block has no child blocks.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder relationships(Relationship... relationships);
/**
*
* A list of relationship objects that describe how blocks are related to each other. For example, a LINE block
* object contains a CHILD relationship type with the WORD blocks that make up the line of text. There aren't
* Relationship objects in the list for relationships that don't exist, such as when the current block has no
* child blocks.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.textract.model.Relationship.Builder} avoiding the need to create one
* manually via {@link software.amazon.awssdk.services.textract.model.Relationship#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.textract.model.Relationship.Builder#build()} is called immediately and
* its result is passed to {@link #relationships(List)}.
*
* @param relationships
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.textract.model.Relationship.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #relationships(java.util.Collection)
*/
Builder relationships(Consumer... relationships);
/**
*
* The type of entity.
*
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title
* is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds
* to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*
*
* @param entityTypes
* The type of entity.
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section
* title is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or
* an additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row
* corresponds to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder entityTypesWithStrings(Collection entityTypes);
/**
*
* The type of entity.
*
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title
* is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds
* to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*
*
* @param entityTypes
* The type of entity.
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section
* title is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or
* an additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row
* corresponds to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder entityTypesWithStrings(String... entityTypes);
/**
*
* The type of entity.
*
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title
* is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds
* to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*
*
* @param entityTypes
* The type of entity.
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section
* title is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or
* an additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row
* corresponds to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder entityTypes(Collection entityTypes);
/**
*
* The type of entity.
*
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title
* is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an
* additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds
* to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
*
*
* @param entityTypes
* The type of entity.
*
* The following entity types can be returned by FORMS analysis:
*
*
* -
*
* KEY - An identifier for a field on the document.
*
*
* -
*
* VALUE - The field text.
*
*
*
*
* The following entity types can be returned by TABLES analysis:
*
*
* -
*
* COLUMN_HEADER - Identifies a cell that is a header of a column.
*
*
* -
*
* TABLE_TITLE - Identifies a cell that is a title within the table.
*
*
* -
*
* TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section
* title is a cell that typically spans an entire row above a section.
*
*
* -
*
* TABLE_FOOTER - Identifies a cell that is a footer of a table.
*
*
* -
*
* TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or
* an additional, smaller table that contains summary information for another table.
*
*
* -
*
* STRUCTURED_TABLE - Identifies a table with column headers where the content of each row
* corresponds to the headers.
*
*
* -
*
* SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
*
*
*
*
* EntityTypes
isn't returned by DetectDocumentText
and
* GetDocumentTextDetection
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder entityTypes(EntityType... entityTypes);
/**
*
* The selection status of a selection element, such as an option button or check box.
*
*
* @param selectionStatus
* The selection status of a selection element, such as an option button or check box.
* @see SelectionStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see SelectionStatus
*/
Builder selectionStatus(String selectionStatus);
/**
*
* The selection status of a selection element, such as an option button or check box.
*
*
* @param selectionStatus
* The selection status of a selection element, such as an option button or check box.
* @see SelectionStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see SelectionStatus
*/
Builder selectionStatus(SelectionStatus selectionStatus);
/**
*
* The page on which a block was detected. Page
is returned by synchronous and asynchronous
* operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF
* format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple
* document pages, is considered a single-page document. This means that for scanned images the value of
* Page
is always 1.
*
*
* @param page
* The page on which a block was detected. Page
is returned by synchronous and asynchronous
* operations. Page values greater than 1 are only returned for multipage documents that are in PDF or
* TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains
* multiple document pages, is considered a single-page document. This means that for scanned images the
* value of Page
is always 1.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder page(Integer page);
/**
*
*
* @param query
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder query(Query query);
/**
*
* This is a convenience method that creates an instance of the {@link Query.Builder} avoiding the need to
* create one manually via {@link Query#builder()}.
*
*
* When the {@link Consumer} completes, {@link Query.Builder#build()} is called immediately and its result is
* passed to {@link #query(Query)}.
*
* @param query
* a consumer that will call methods on {@link Query.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #query(Query)
*/
default Builder query(Consumer query) {
return query(Query.builder().applyMutation(query).build());
}
}
static final class BuilderImpl implements Builder {
private String blockType;
private Float confidence;
private String text;
private String textType;
private Integer rowIndex;
private Integer columnIndex;
private Integer rowSpan;
private Integer columnSpan;
private Geometry geometry;
private String id;
private List relationships = DefaultSdkAutoConstructList.getInstance();
private List entityTypes = DefaultSdkAutoConstructList.getInstance();
private String selectionStatus;
private Integer page;
private Query query;
private BuilderImpl() {
}
private BuilderImpl(Block model) {
blockType(model.blockType);
confidence(model.confidence);
text(model.text);
textType(model.textType);
rowIndex(model.rowIndex);
columnIndex(model.columnIndex);
rowSpan(model.rowSpan);
columnSpan(model.columnSpan);
geometry(model.geometry);
id(model.id);
relationships(model.relationships);
entityTypesWithStrings(model.entityTypes);
selectionStatus(model.selectionStatus);
page(model.page);
query(model.query);
}
public final String getBlockType() {
return blockType;
}
public final void setBlockType(String blockType) {
this.blockType = blockType;
}
@Override
public final Builder blockType(String blockType) {
this.blockType = blockType;
return this;
}
@Override
public final Builder blockType(BlockType blockType) {
this.blockType(blockType == null ? null : blockType.toString());
return this;
}
public final Float getConfidence() {
return confidence;
}
public final void setConfidence(Float confidence) {
this.confidence = confidence;
}
@Override
public final Builder confidence(Float confidence) {
this.confidence = confidence;
return this;
}
public final String getText() {
return text;
}
public final void setText(String text) {
this.text = text;
}
@Override
public final Builder text(String text) {
this.text = text;
return this;
}
public final String getTextType() {
return textType;
}
public final void setTextType(String textType) {
this.textType = textType;
}
@Override
public final Builder textType(String textType) {
this.textType = textType;
return this;
}
@Override
public final Builder textType(TextType textType) {
this.textType(textType == null ? null : textType.toString());
return this;
}
public final Integer getRowIndex() {
return rowIndex;
}
public final void setRowIndex(Integer rowIndex) {
this.rowIndex = rowIndex;
}
@Override
public final Builder rowIndex(Integer rowIndex) {
this.rowIndex = rowIndex;
return this;
}
public final Integer getColumnIndex() {
return columnIndex;
}
public final void setColumnIndex(Integer columnIndex) {
this.columnIndex = columnIndex;
}
@Override
public final Builder columnIndex(Integer columnIndex) {
this.columnIndex = columnIndex;
return this;
}
public final Integer getRowSpan() {
return rowSpan;
}
public final void setRowSpan(Integer rowSpan) {
this.rowSpan = rowSpan;
}
@Override
public final Builder rowSpan(Integer rowSpan) {
this.rowSpan = rowSpan;
return this;
}
public final Integer getColumnSpan() {
return columnSpan;
}
public final void setColumnSpan(Integer columnSpan) {
this.columnSpan = columnSpan;
}
@Override
public final Builder columnSpan(Integer columnSpan) {
this.columnSpan = columnSpan;
return this;
}
public final Geometry.Builder getGeometry() {
return geometry != null ? geometry.toBuilder() : null;
}
public final void setGeometry(Geometry.BuilderImpl geometry) {
this.geometry = geometry != null ? geometry.build() : null;
}
@Override
public final Builder geometry(Geometry geometry) {
this.geometry = geometry;
return this;
}
public final String getId() {
return id;
}
public final void setId(String id) {
this.id = id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final List getRelationships() {
List result = RelationshipListCopier.copyToBuilder(this.relationships);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setRelationships(Collection relationships) {
this.relationships = RelationshipListCopier.copyFromBuilder(relationships);
}
@Override
public final Builder relationships(Collection relationships) {
this.relationships = RelationshipListCopier.copy(relationships);
return this;
}
@Override
@SafeVarargs
public final Builder relationships(Relationship... relationships) {
relationships(Arrays.asList(relationships));
return this;
}
@Override
@SafeVarargs
public final Builder relationships(Consumer... relationships) {
relationships(Stream.of(relationships).map(c -> Relationship.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final Collection getEntityTypes() {
if (entityTypes instanceof SdkAutoConstructList) {
return null;
}
return entityTypes;
}
public final void setEntityTypes(Collection entityTypes) {
this.entityTypes = EntityTypesCopier.copy(entityTypes);
}
@Override
public final Builder entityTypesWithStrings(Collection entityTypes) {
this.entityTypes = EntityTypesCopier.copy(entityTypes);
return this;
}
@Override
@SafeVarargs
public final Builder entityTypesWithStrings(String... entityTypes) {
entityTypesWithStrings(Arrays.asList(entityTypes));
return this;
}
@Override
public final Builder entityTypes(Collection entityTypes) {
this.entityTypes = EntityTypesCopier.copyEnumToString(entityTypes);
return this;
}
@Override
@SafeVarargs
public final Builder entityTypes(EntityType... entityTypes) {
entityTypes(Arrays.asList(entityTypes));
return this;
}
public final String getSelectionStatus() {
return selectionStatus;
}
public final void setSelectionStatus(String selectionStatus) {
this.selectionStatus = selectionStatus;
}
@Override
public final Builder selectionStatus(String selectionStatus) {
this.selectionStatus = selectionStatus;
return this;
}
@Override
public final Builder selectionStatus(SelectionStatus selectionStatus) {
this.selectionStatus(selectionStatus == null ? null : selectionStatus.toString());
return this;
}
public final Integer getPage() {
return page;
}
public final void setPage(Integer page) {
this.page = page;
}
@Override
public final Builder page(Integer page) {
this.page = page;
return this;
}
public final Query.Builder getQuery() {
return query != null ? query.toBuilder() : null;
}
public final void setQuery(Query.BuilderImpl query) {
this.query = query != null ? query.build() : null;
}
@Override
public final Builder query(Query query) {
this.query = query;
return this;
}
@Override
public Block build() {
return new Block(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}