Class TextAnnotation.Builder (3.53.0)

public static final class TextAnnotation.Builder extends GeneratedMessageV3.Builder<TextAnnotation.Builder> implements TextAnnotationOrBuilder

TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. Please refer to the TextAnnotation.TextProperty message definition below for more detail.

Protobuf type google.cloud.vision.v1.TextAnnotation

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllPages(Iterable<? extends Page> values)

public TextAnnotation.Builder addAllPages(Iterable<? extends Page> values)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
values Iterable<? extends com.google.cloud.vision.v1.Page>
Returns
Type Description
TextAnnotation.Builder

addPages(Page value)

public TextAnnotation.Builder addPages(Page value)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
value Page
Returns
Type Description
TextAnnotation.Builder

addPages(Page.Builder builderForValue)

public TextAnnotation.Builder addPages(Page.Builder builderForValue)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
builderForValue Page.Builder
Returns
Type Description
TextAnnotation.Builder

addPages(int index, Page value)

public TextAnnotation.Builder addPages(int index, Page value)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameters
Name Description
index int
value Page
Returns
Type Description
TextAnnotation.Builder

addPages(int index, Page.Builder builderForValue)

public TextAnnotation.Builder addPages(int index, Page.Builder builderForValue)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameters
Name Description
index int
builderForValue Page.Builder
Returns
Type Description
TextAnnotation.Builder

addPagesBuilder()

public Page.Builder addPagesBuilder()

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Returns
Type Description
Page.Builder

addPagesBuilder(int index)

public Page.Builder addPagesBuilder(int index)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
index int
Returns
Type Description
Page.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public TextAnnotation.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
TextAnnotation.Builder
Overrides

build()

public TextAnnotation build()
Returns
Type Description
TextAnnotation

buildPartial()

public TextAnnotation buildPartial()
Returns
Type Description
TextAnnotation

clear()

public TextAnnotation.Builder clear()
Returns
Type Description
TextAnnotation.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public TextAnnotation.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
TextAnnotation.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public TextAnnotation.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
TextAnnotation.Builder
Overrides

clearPages()

public TextAnnotation.Builder clearPages()

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Returns
Type Description
TextAnnotation.Builder

clearText()

public TextAnnotation.Builder clearText()

UTF-8 text detected on the pages.

string text = 2;

Returns
Type Description
TextAnnotation.Builder

This builder for chaining.

clone()

public TextAnnotation.Builder clone()
Returns
Type Description
TextAnnotation.Builder
Overrides

getDefaultInstanceForType()

public TextAnnotation getDefaultInstanceForType()
Returns
Type Description
TextAnnotation

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getPages(int index)

public Page getPages(int index)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
index int
Returns
Type Description
Page

getPagesBuilder(int index)

public Page.Builder getPagesBuilder(int index)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
index int
Returns
Type Description
Page.Builder

getPagesBuilderList()

public List<Page.Builder> getPagesBuilderList()

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Returns
Type Description
List<Builder>

getPagesCount()

public int getPagesCount()

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Returns
Type Description
int

getPagesList()

public List<Page> getPagesList()

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Returns
Type Description
List<Page>

getPagesOrBuilder(int index)

public PageOrBuilder getPagesOrBuilder(int index)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
index int
Returns
Type Description
PageOrBuilder

getPagesOrBuilderList()

public List<? extends PageOrBuilder> getPagesOrBuilderList()

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Returns
Type Description
List<? extends com.google.cloud.vision.v1.PageOrBuilder>

getText()

public String getText()

UTF-8 text detected on the pages.

string text = 2;

Returns
Type Description
String

The text.

getTextBytes()

public ByteString getTextBytes()

UTF-8 text detected on the pages.

string text = 2;

Returns
Type Description
ByteString

The bytes for text.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(TextAnnotation other)

public TextAnnotation.Builder mergeFrom(TextAnnotation other)
Parameter
Name Description
other TextAnnotation
Returns
Type Description
TextAnnotation.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public TextAnnotation.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
TextAnnotation.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public TextAnnotation.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
TextAnnotation.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final TextAnnotation.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
TextAnnotation.Builder
Overrides

removePages(int index)

public TextAnnotation.Builder removePages(int index)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameter
Name Description
index int
Returns
Type Description
TextAnnotation.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public TextAnnotation.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
TextAnnotation.Builder
Overrides

setPages(int index, Page value)

public TextAnnotation.Builder setPages(int index, Page value)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameters
Name Description
index int
value Page
Returns
Type Description
TextAnnotation.Builder

setPages(int index, Page.Builder builderForValue)

public TextAnnotation.Builder setPages(int index, Page.Builder builderForValue)

List of pages detected by OCR.

repeated .google.cloud.vision.v1.Page pages = 1;

Parameters
Name Description
index int
builderForValue Page.Builder
Returns
Type Description
TextAnnotation.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public TextAnnotation.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
TextAnnotation.Builder
Overrides

setText(String value)

public TextAnnotation.Builder setText(String value)

UTF-8 text detected on the pages.

string text = 2;

Parameter
Name Description
value String

The text to set.

Returns
Type Description
TextAnnotation.Builder

This builder for chaining.

setTextBytes(ByteString value)

public TextAnnotation.Builder setTextBytes(ByteString value)

UTF-8 text detected on the pages.

string text = 2;

Parameter
Name Description
value ByteString

The bytes for text to set.

Returns
Type Description
TextAnnotation.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final TextAnnotation.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
TextAnnotation.Builder
Overrides