Class Document

  • All Implemented Interfaces:
    DocumentOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable

    public final class Document
    extends com.google.protobuf.GeneratedMessageV3
    implements DocumentOrBuilder
     Document represents the canonical document resource in Document AI. It is an
     interchange format that provides insights into documents and allows for
     collaboration between users and Document AI to iterate and optimize for
     quality.
     
    Protobuf type google.cloud.documentai.v1.Document
    See Also:
    Serialized Form
    • Method Detail

      • newInstance

        protected Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
      • hasUri

        public boolean hasUri()
         Optional. Currently supports Google Cloud Storage URI of the form
         `gs://bucket_name/object_name`. Object versioning is not supported.
         For more information, refer to [Google Cloud Storage Request
         URIs](https://cloud.google.com/storage/docs/reference-uris).
         
        string uri = 1 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        hasUri in interface DocumentOrBuilder
        Returns:
        Whether the uri field is set.
      • getUri

        public String getUri()
         Optional. Currently supports Google Cloud Storage URI of the form
         `gs://bucket_name/object_name`. Object versioning is not supported.
         For more information, refer to [Google Cloud Storage Request
         URIs](https://cloud.google.com/storage/docs/reference-uris).
         
        string uri = 1 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getUri in interface DocumentOrBuilder
        Returns:
        The uri.
      • getUriBytes

        public com.google.protobuf.ByteString getUriBytes()
         Optional. Currently supports Google Cloud Storage URI of the form
         `gs://bucket_name/object_name`. Object versioning is not supported.
         For more information, refer to [Google Cloud Storage Request
         URIs](https://cloud.google.com/storage/docs/reference-uris).
         
        string uri = 1 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getUriBytes in interface DocumentOrBuilder
        Returns:
        The bytes for uri.
      • hasContent

        public boolean hasContent()
         Optional. Inline document content, represented as a stream of bytes.
         Note: As with all `bytes` fields, protobuffers use a pure binary
         representation, whereas JSON representations use base64.
         
        bytes content = 2 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        hasContent in interface DocumentOrBuilder
        Returns:
        Whether the content field is set.
      • getContent

        public com.google.protobuf.ByteString getContent()
         Optional. Inline document content, represented as a stream of bytes.
         Note: As with all `bytes` fields, protobuffers use a pure binary
         representation, whereas JSON representations use base64.
         
        bytes content = 2 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getContent in interface DocumentOrBuilder
        Returns:
        The content.
      • getMimeType

        public String getMimeType()
         An IANA published [media type (MIME
         type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
         
        string mime_type = 3;
        Specified by:
        getMimeType in interface DocumentOrBuilder
        Returns:
        The mimeType.
      • getMimeTypeBytes

        public com.google.protobuf.ByteString getMimeTypeBytes()
         An IANA published [media type (MIME
         type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
         
        string mime_type = 3;
        Specified by:
        getMimeTypeBytes in interface DocumentOrBuilder
        Returns:
        The bytes for mimeType.
      • getText

        public String getText()
         Optional. UTF-8 encoded text in reading order from the document.
         
        string text = 4 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getText in interface DocumentOrBuilder
        Returns:
        The text.
      • getTextBytes

        public com.google.protobuf.ByteString getTextBytes()
         Optional. UTF-8 encoded text in reading order from the document.
         
        string text = 4 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getTextBytes in interface DocumentOrBuilder
        Returns:
        The bytes for text.
      • getTextStylesList

        @Deprecated
        public List<Document.Style> getTextStylesList()
        Deprecated.
         Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
         
        repeated .google.cloud.documentai.v1.Document.Style text_styles = 5 [deprecated = true];
        Specified by:
        getTextStylesList in interface DocumentOrBuilder
      • getTextStylesCount

        @Deprecated
        public int getTextStylesCount()
        Deprecated.
         Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
         
        repeated .google.cloud.documentai.v1.Document.Style text_styles = 5 [deprecated = true];
        Specified by:
        getTextStylesCount in interface DocumentOrBuilder
      • getTextStyles

        @Deprecated
        public Document.Style getTextStyles​(int index)
        Deprecated.
         Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
         
        repeated .google.cloud.documentai.v1.Document.Style text_styles = 5 [deprecated = true];
        Specified by:
        getTextStyles in interface DocumentOrBuilder
      • getPagesList

        public List<Document.Page> getPagesList()
         Visual page layout for the [Document][google.cloud.documentai.v1.Document].
         
        repeated .google.cloud.documentai.v1.Document.Page pages = 6;
        Specified by:
        getPagesList in interface DocumentOrBuilder
      • getPagesCount

        public int getPagesCount()
         Visual page layout for the [Document][google.cloud.documentai.v1.Document].
         
        repeated .google.cloud.documentai.v1.Document.Page pages = 6;
        Specified by:
        getPagesCount in interface DocumentOrBuilder
      • getPages

        public Document.Page getPages​(int index)
         Visual page layout for the [Document][google.cloud.documentai.v1.Document].
         
        repeated .google.cloud.documentai.v1.Document.Page pages = 6;
        Specified by:
        getPages in interface DocumentOrBuilder
      • getPagesOrBuilder

        public Document.PageOrBuilder getPagesOrBuilder​(int index)
         Visual page layout for the [Document][google.cloud.documentai.v1.Document].
         
        repeated .google.cloud.documentai.v1.Document.Page pages = 6;
        Specified by:
        getPagesOrBuilder in interface DocumentOrBuilder
      • getEntitiesList

        public List<Document.Entity> getEntitiesList()
         A list of entities detected on
         [Document.text][google.cloud.documentai.v1.Document.text]. For document
         shards, entities in this list may cross shard boundaries.
         
        repeated .google.cloud.documentai.v1.Document.Entity entities = 7;
        Specified by:
        getEntitiesList in interface DocumentOrBuilder
      • getEntitiesOrBuilderList

        public List<? extends Document.EntityOrBuilder> getEntitiesOrBuilderList()
         A list of entities detected on
         [Document.text][google.cloud.documentai.v1.Document.text]. For document
         shards, entities in this list may cross shard boundaries.
         
        repeated .google.cloud.documentai.v1.Document.Entity entities = 7;
        Specified by:
        getEntitiesOrBuilderList in interface DocumentOrBuilder
      • getEntitiesCount

        public int getEntitiesCount()
         A list of entities detected on
         [Document.text][google.cloud.documentai.v1.Document.text]. For document
         shards, entities in this list may cross shard boundaries.
         
        repeated .google.cloud.documentai.v1.Document.Entity entities = 7;
        Specified by:
        getEntitiesCount in interface DocumentOrBuilder
      • getEntities

        public Document.Entity getEntities​(int index)
         A list of entities detected on
         [Document.text][google.cloud.documentai.v1.Document.text]. For document
         shards, entities in this list may cross shard boundaries.
         
        repeated .google.cloud.documentai.v1.Document.Entity entities = 7;
        Specified by:
        getEntities in interface DocumentOrBuilder
      • getEntitiesOrBuilder

        public Document.EntityOrBuilder getEntitiesOrBuilder​(int index)
         A list of entities detected on
         [Document.text][google.cloud.documentai.v1.Document.text]. For document
         shards, entities in this list may cross shard boundaries.
         
        repeated .google.cloud.documentai.v1.Document.Entity entities = 7;
        Specified by:
        getEntitiesOrBuilder in interface DocumentOrBuilder
      • getEntityRelationsList

        public List<Document.EntityRelation> getEntityRelationsList()
         Placeholder.  Relationship among
         [Document.entities][google.cloud.documentai.v1.Document.entities].
         
        repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8;
        Specified by:
        getEntityRelationsList in interface DocumentOrBuilder
      • getEntityRelationsCount

        public int getEntityRelationsCount()
         Placeholder.  Relationship among
         [Document.entities][google.cloud.documentai.v1.Document.entities].
         
        repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8;
        Specified by:
        getEntityRelationsCount in interface DocumentOrBuilder
      • getEntityRelations

        public Document.EntityRelation getEntityRelations​(int index)
         Placeholder.  Relationship among
         [Document.entities][google.cloud.documentai.v1.Document.entities].
         
        repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8;
        Specified by:
        getEntityRelations in interface DocumentOrBuilder
      • getTextChangesList

        public List<Document.TextChange> getTextChangesList()
         Placeholder.  A list of text corrections made to
         [Document.text][google.cloud.documentai.v1.Document.text].  This is usually
         used for annotating corrections to OCR mistakes.  Text changes for a given
         revision may not overlap with each other.
         
        repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14;
        Specified by:
        getTextChangesList in interface DocumentOrBuilder
      • getTextChangesOrBuilderList

        public List<? extends Document.TextChangeOrBuilder> getTextChangesOrBuilderList()
         Placeholder.  A list of text corrections made to
         [Document.text][google.cloud.documentai.v1.Document.text].  This is usually
         used for annotating corrections to OCR mistakes.  Text changes for a given
         revision may not overlap with each other.
         
        repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14;
        Specified by:
        getTextChangesOrBuilderList in interface DocumentOrBuilder
      • getTextChangesCount

        public int getTextChangesCount()
         Placeholder.  A list of text corrections made to
         [Document.text][google.cloud.documentai.v1.Document.text].  This is usually
         used for annotating corrections to OCR mistakes.  Text changes for a given
         revision may not overlap with each other.
         
        repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14;
        Specified by:
        getTextChangesCount in interface DocumentOrBuilder
      • getTextChanges

        public Document.TextChange getTextChanges​(int index)
         Placeholder.  A list of text corrections made to
         [Document.text][google.cloud.documentai.v1.Document.text].  This is usually
         used for annotating corrections to OCR mistakes.  Text changes for a given
         revision may not overlap with each other.
         
        repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14;
        Specified by:
        getTextChanges in interface DocumentOrBuilder
      • getTextChangesOrBuilder

        public Document.TextChangeOrBuilder getTextChangesOrBuilder​(int index)
         Placeholder.  A list of text corrections made to
         [Document.text][google.cloud.documentai.v1.Document.text].  This is usually
         used for annotating corrections to OCR mistakes.  Text changes for a given
         revision may not overlap with each other.
         
        repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14;
        Specified by:
        getTextChangesOrBuilder in interface DocumentOrBuilder
      • hasShardInfo

        public boolean hasShardInfo()
         Information about the sharding if this document is sharded part of a larger
         document. If the document is not sharded, this message is not specified.
         
        .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9;
        Specified by:
        hasShardInfo in interface DocumentOrBuilder
        Returns:
        Whether the shardInfo field is set.
      • getShardInfo

        public Document.ShardInfo getShardInfo()
         Information about the sharding if this document is sharded part of a larger
         document. If the document is not sharded, this message is not specified.
         
        .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9;
        Specified by:
        getShardInfo in interface DocumentOrBuilder
        Returns:
        The shardInfo.
      • getShardInfoOrBuilder

        public Document.ShardInfoOrBuilder getShardInfoOrBuilder()
         Information about the sharding if this document is sharded part of a larger
         document. If the document is not sharded, this message is not specified.
         
        .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9;
        Specified by:
        getShardInfoOrBuilder in interface DocumentOrBuilder
      • hasError

        public boolean hasError()
         Any error that occurred while processing this document.
         
        .google.rpc.Status error = 10;
        Specified by:
        hasError in interface DocumentOrBuilder
        Returns:
        Whether the error field is set.
      • getError

        public com.google.rpc.Status getError()
         Any error that occurred while processing this document.
         
        .google.rpc.Status error = 10;
        Specified by:
        getError in interface DocumentOrBuilder
        Returns:
        The error.
      • getErrorOrBuilder

        public com.google.rpc.StatusOrBuilder getErrorOrBuilder()
         Any error that occurred while processing this document.
         
        .google.rpc.Status error = 10;
        Specified by:
        getErrorOrBuilder in interface DocumentOrBuilder
      • getRevisionsCount

        public int getRevisionsCount()
         Placeholder. Revision history of this document.
         
        repeated .google.cloud.documentai.v1.Document.Revision revisions = 13;
        Specified by:
        getRevisionsCount in interface DocumentOrBuilder
      • getRevisions

        public Document.Revision getRevisions​(int index)
         Placeholder. Revision history of this document.
         
        repeated .google.cloud.documentai.v1.Document.Revision revisions = 13;
        Specified by:
        getRevisions in interface DocumentOrBuilder
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static Document parseFrom​(ByteBuffer data)
                                  throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static Document parseFrom​(ByteBuffer data,
                                         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                  throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static Document parseFrom​(com.google.protobuf.ByteString data)
                                  throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static Document parseFrom​(com.google.protobuf.ByteString data,
                                         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                  throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static Document parseFrom​(byte[] data)
                                  throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static Document parseFrom​(byte[] data,
                                         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                  throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static Document parseFrom​(com.google.protobuf.CodedInputStream input,
                                         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                  throws IOException
        Throws:
        IOException
      • newBuilderForType

        public Document.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface com.google.protobuf.Message
        Specified by:
        newBuilderForType in interface com.google.protobuf.MessageLite
      • toBuilder

        public Document.Builder toBuilder()
        Specified by:
        toBuilder in interface com.google.protobuf.Message
        Specified by:
        toBuilder in interface com.google.protobuf.MessageLite
      • newBuilderForType

        protected Document.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstance

        public static Document getDefaultInstance()
      • parser

        public static com.google.protobuf.Parser<Document> parser()
      • getParserForType

        public com.google.protobuf.Parser<Document> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public Document getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder