All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.comprehend.model.Block Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Comprehend module holds the client classes that are used for communicating with Amazon Comprehend Service

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2018-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.comprehend.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* Information about each word or line of text in the input document. *

*

* For additional information, see Block in * the Amazon Textract API reference. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Block implements Serializable, Cloneable, StructuredPojo { /** *

* Unique identifier for the block. *

*/ private String id; /** *

* The block represents a line of text or one word of text. *

*
    *
  • *

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

    *
  • *
*/ private String blockType; /** *

* The word or line of text extracted from the block. *

*/ private String text; /** *

* Page number where the block appears. *

*/ private Integer page; /** *

* Co-ordinates of the rectangle or polygon that contains the text. *

*/ private Geometry geometry; /** *

* A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD block * that's part of the line of text. *

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

* Unique identifier for the block. *

* * @param id * Unique identifier for the block. */ public void setId(String id) { this.id = id; } /** *

* Unique identifier for the block. *

* * @return Unique identifier for the block. */ public String getId() { return this.id; } /** *

* Unique identifier for the block. *

* * @param id * Unique identifier for the block. * @return Returns a reference to this object so that method calls can be chained together. */ public Block withId(String id) { setId(id); return this; } /** *

* The block represents a line of text or one word of text. *

*
    *
  • *

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

    *
  • *
* * @param blockType * The block represents a line of text or one word of text.

*
    *
  • *

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

    *
  • * @see BlockType */ public void setBlockType(String blockType) { this.blockType = blockType; } /** *

    * The block represents a line of text or one word of text. *

    *
      *
    • *

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

      *
    • *
    * * @return The block represents a line of text or one word of text.

    *
      *
    • *

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

      *
    • * @see BlockType */ public String getBlockType() { return this.blockType; } /** *

      * The block represents a line of text or one word of text. *

      *
        *
      • *

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

        *
      • *
      * * @param blockType * The block represents a line of text or one word of text.

      *
        *
      • *

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

        *
      • * @return Returns a reference to this object so that method calls can be chained together. * @see BlockType */ public Block withBlockType(String blockType) { setBlockType(blockType); return this; } /** *

        * The block represents a line of text or one word of text. *

        *
          *
        • *

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

          *
        • *
        * * @param blockType * The block represents a line of text or one word of text.

        *
          *
        • *

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

          *
        • * @return Returns a reference to this object so that method calls can be chained together. * @see BlockType */ public Block withBlockType(BlockType blockType) { this.blockType = blockType.toString(); return this; } /** *

          * The word or line of text extracted from the block. *

          * * @param text * The word or line of text extracted from the block. */ public void setText(String text) { this.text = text; } /** *

          * The word or line of text extracted from the block. *

          * * @return The word or line of text extracted from the block. */ public String getText() { return this.text; } /** *

          * The word or line of text extracted from the block. *

          * * @param text * The word or line of text extracted from the block. * @return Returns a reference to this object so that method calls can be chained together. */ public Block withText(String text) { setText(text); return this; } /** *

          * Page number where the block appears. *

          * * @param page * Page number where the block appears. */ public void setPage(Integer page) { this.page = page; } /** *

          * Page number where the block appears. *

          * * @return Page number where the block appears. */ public Integer getPage() { return this.page; } /** *

          * Page number where the block appears. *

          * * @param page * Page number where the block appears. * @return Returns a reference to this object so that method calls can be chained together. */ public Block withPage(Integer page) { setPage(page); return this; } /** *

          * Co-ordinates of the rectangle or polygon that contains the text. *

          * * @param geometry * Co-ordinates of the rectangle or polygon that contains the text. */ public void setGeometry(Geometry geometry) { this.geometry = geometry; } /** *

          * Co-ordinates of the rectangle or polygon that contains the text. *

          * * @return Co-ordinates of the rectangle or polygon that contains the text. */ public Geometry getGeometry() { return this.geometry; } /** *

          * Co-ordinates of the rectangle or polygon that contains the text. *

          * * @param geometry * Co-ordinates of the rectangle or polygon that contains the text. * @return Returns a reference to this object so that method calls can be chained together. */ public Block withGeometry(Geometry geometry) { setGeometry(geometry); return this; } /** *

          * A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD block * that's part of the line of text. *

          * * @return A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD * block that's part of the line of text. */ public java.util.List getRelationships() { return relationships; } /** *

          * A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD block * that's part of the line of text. *

          * * @param relationships * A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD * block that's part of the line of text. */ public void setRelationships(java.util.Collection relationships) { if (relationships == null) { this.relationships = null; return; } this.relationships = new java.util.ArrayList(relationships); } /** *

          * A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD block * that's part of the line of text. *

          *

          * NOTE: This method appends the values to the existing list (if any). Use * {@link #setRelationships(java.util.Collection)} or {@link #withRelationships(java.util.Collection)} if you want * to override the existing values. *

          * * @param relationships * A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD * block that's part of the line of text. * @return Returns a reference to this object so that method calls can be chained together. */ public Block withRelationships(RelationshipsListItem... relationships) { if (this.relationships == null) { setRelationships(new java.util.ArrayList(relationships.length)); } for (RelationshipsListItem ele : relationships) { this.relationships.add(ele); } return this; } /** *

          * A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD block * that's part of the line of text. *

          * * @param relationships * A list of child blocks of the current block. For example, a LINE object has child blocks for each WORD * block that's part of the line of text. * @return Returns a reference to this object so that method calls can be chained together. */ public Block withRelationships(java.util.Collection relationships) { setRelationships(relationships); return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getId() != null) sb.append("Id: ").append(getId()).append(","); if (getBlockType() != null) sb.append("BlockType: ").append(getBlockType()).append(","); if (getText() != null) sb.append("Text: ").append(getText()).append(","); if (getPage() != null) sb.append("Page: ").append(getPage()).append(","); if (getGeometry() != null) sb.append("Geometry: ").append(getGeometry()).append(","); if (getRelationships() != null) sb.append("Relationships: ").append(getRelationships()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Block == false) return false; Block other = (Block) obj; if (other.getId() == null ^ this.getId() == null) return false; if (other.getId() != null && other.getId().equals(this.getId()) == false) return false; if (other.getBlockType() == null ^ this.getBlockType() == null) return false; if (other.getBlockType() != null && other.getBlockType().equals(this.getBlockType()) == false) return false; if (other.getText() == null ^ this.getText() == null) return false; if (other.getText() != null && other.getText().equals(this.getText()) == false) return false; if (other.getPage() == null ^ this.getPage() == null) return false; if (other.getPage() != null && other.getPage().equals(this.getPage()) == false) return false; if (other.getGeometry() == null ^ this.getGeometry() == null) return false; if (other.getGeometry() != null && other.getGeometry().equals(this.getGeometry()) == false) return false; if (other.getRelationships() == null ^ this.getRelationships() == null) return false; if (other.getRelationships() != null && other.getRelationships().equals(this.getRelationships()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getBlockType() == null) ? 0 : getBlockType().hashCode()); hashCode = prime * hashCode + ((getText() == null) ? 0 : getText().hashCode()); hashCode = prime * hashCode + ((getPage() == null) ? 0 : getPage().hashCode()); hashCode = prime * hashCode + ((getGeometry() == null) ? 0 : getGeometry().hashCode()); hashCode = prime * hashCode + ((getRelationships() == null) ? 0 : getRelationships().hashCode()); return hashCode; } @Override public Block clone() { try { return (Block) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.comprehend.model.transform.BlockMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy