com.google.cloud.vision.v1.ImageContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grpc-google-cloud-vision-v1 Show documentation
Show all versions of grpc-google-cloud-vision-v1 Show documentation
GRPC library for grpc-google-cloud-vision-v1
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/vision/v1/image_annotator.proto
package com.google.cloud.vision.v1;
/**
*
* Image context.
*
*
* Protobuf type {@code google.cloud.vision.v1.ImageContext}
*/
public final class ImageContext extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.cloud.vision.v1.ImageContext)
ImageContextOrBuilder {
// Use ImageContext.newBuilder() to construct.
private ImageContext(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private ImageContext() {
languageHints_ = com.google.protobuf.LazyStringArrayList.EMPTY;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
}
private ImageContext(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
int mutable_bitField0_ = 0;
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!input.skipField(tag)) {
done = true;
}
break;
}
case 10: {
com.google.cloud.vision.v1.LatLongRect.Builder subBuilder = null;
if (latLongRect_ != null) {
subBuilder = latLongRect_.toBuilder();
}
latLongRect_ = input.readMessage(com.google.cloud.vision.v1.LatLongRect.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(latLongRect_);
latLongRect_ = subBuilder.buildPartial();
}
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
languageHints_ = new com.google.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000002;
}
languageHints_.add(s);
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
languageHints_ = languageHints_.getUnmodifiableView();
}
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_ImageContext_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_ImageContext_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.vision.v1.ImageContext.class, com.google.cloud.vision.v1.ImageContext.Builder.class);
}
private int bitField0_;
public static final int LAT_LONG_RECT_FIELD_NUMBER = 1;
private com.google.cloud.vision.v1.LatLongRect latLongRect_;
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public boolean hasLatLongRect() {
return latLongRect_ != null;
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public com.google.cloud.vision.v1.LatLongRect getLatLongRect() {
return latLongRect_ == null ? com.google.cloud.vision.v1.LatLongRect.getDefaultInstance() : latLongRect_;
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public com.google.cloud.vision.v1.LatLongRectOrBuilder getLatLongRectOrBuilder() {
return getLatLongRect();
}
public static final int LANGUAGE_HINTS_FIELD_NUMBER = 2;
private com.google.protobuf.LazyStringList languageHints_;
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public com.google.protobuf.ProtocolStringList
getLanguageHintsList() {
return languageHints_;
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public int getLanguageHintsCount() {
return languageHints_.size();
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public java.lang.String getLanguageHints(int index) {
return languageHints_.get(index);
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public com.google.protobuf.ByteString
getLanguageHintsBytes(int index) {
return languageHints_.getByteString(index);
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (latLongRect_ != null) {
output.writeMessage(1, getLatLongRect());
}
for (int i = 0; i < languageHints_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, languageHints_.getRaw(i));
}
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (latLongRect_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, getLatLongRect());
}
{
int dataSize = 0;
for (int i = 0; i < languageHints_.size(); i++) {
dataSize += computeStringSizeNoTag(languageHints_.getRaw(i));
}
size += dataSize;
size += 1 * getLanguageHintsList().size();
}
memoizedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.vision.v1.ImageContext)) {
return super.equals(obj);
}
com.google.cloud.vision.v1.ImageContext other = (com.google.cloud.vision.v1.ImageContext) obj;
boolean result = true;
result = result && (hasLatLongRect() == other.hasLatLongRect());
if (hasLatLongRect()) {
result = result && getLatLongRect()
.equals(other.getLatLongRect());
}
result = result && getLanguageHintsList()
.equals(other.getLanguageHintsList());
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptorForType().hashCode();
if (hasLatLongRect()) {
hash = (37 * hash) + LAT_LONG_RECT_FIELD_NUMBER;
hash = (53 * hash) + getLatLongRect().hashCode();
}
if (getLanguageHintsCount() > 0) {
hash = (37 * hash) + LANGUAGE_HINTS_FIELD_NUMBER;
hash = (53 * hash) + getLanguageHintsList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.cloud.vision.v1.ImageContext parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1.ImageContext parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1.ImageContext parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.cloud.vision.v1.ImageContext prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
* Image context.
*
*
* Protobuf type {@code google.cloud.vision.v1.ImageContext}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:google.cloud.vision.v1.ImageContext)
com.google.cloud.vision.v1.ImageContextOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_ImageContext_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_ImageContext_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.vision.v1.ImageContext.class, com.google.cloud.vision.v1.ImageContext.Builder.class);
}
// Construct using com.google.cloud.vision.v1.ImageContext.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
if (latLongRectBuilder_ == null) {
latLongRect_ = null;
} else {
latLongRect_ = null;
latLongRectBuilder_ = null;
}
languageHints_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_ImageContext_descriptor;
}
public com.google.cloud.vision.v1.ImageContext getDefaultInstanceForType() {
return com.google.cloud.vision.v1.ImageContext.getDefaultInstance();
}
public com.google.cloud.vision.v1.ImageContext build() {
com.google.cloud.vision.v1.ImageContext result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.google.cloud.vision.v1.ImageContext buildPartial() {
com.google.cloud.vision.v1.ImageContext result = new com.google.cloud.vision.v1.ImageContext(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (latLongRectBuilder_ == null) {
result.latLongRect_ = latLongRect_;
} else {
result.latLongRect_ = latLongRectBuilder_.build();
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
languageHints_ = languageHints_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000002);
}
result.languageHints_ = languageHints_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.vision.v1.ImageContext) {
return mergeFrom((com.google.cloud.vision.v1.ImageContext)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.vision.v1.ImageContext other) {
if (other == com.google.cloud.vision.v1.ImageContext.getDefaultInstance()) return this;
if (other.hasLatLongRect()) {
mergeLatLongRect(other.getLatLongRect());
}
if (!other.languageHints_.isEmpty()) {
if (languageHints_.isEmpty()) {
languageHints_ = other.languageHints_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureLanguageHintsIsMutable();
languageHints_.addAll(other.languageHints_);
}
onChanged();
}
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.cloud.vision.v1.ImageContext parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.cloud.vision.v1.ImageContext) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.cloud.vision.v1.LatLongRect latLongRect_ = null;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.vision.v1.LatLongRect, com.google.cloud.vision.v1.LatLongRect.Builder, com.google.cloud.vision.v1.LatLongRectOrBuilder> latLongRectBuilder_;
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public boolean hasLatLongRect() {
return latLongRectBuilder_ != null || latLongRect_ != null;
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public com.google.cloud.vision.v1.LatLongRect getLatLongRect() {
if (latLongRectBuilder_ == null) {
return latLongRect_ == null ? com.google.cloud.vision.v1.LatLongRect.getDefaultInstance() : latLongRect_;
} else {
return latLongRectBuilder_.getMessage();
}
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public Builder setLatLongRect(com.google.cloud.vision.v1.LatLongRect value) {
if (latLongRectBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
latLongRect_ = value;
onChanged();
} else {
latLongRectBuilder_.setMessage(value);
}
return this;
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public Builder setLatLongRect(
com.google.cloud.vision.v1.LatLongRect.Builder builderForValue) {
if (latLongRectBuilder_ == null) {
latLongRect_ = builderForValue.build();
onChanged();
} else {
latLongRectBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public Builder mergeLatLongRect(com.google.cloud.vision.v1.LatLongRect value) {
if (latLongRectBuilder_ == null) {
if (latLongRect_ != null) {
latLongRect_ =
com.google.cloud.vision.v1.LatLongRect.newBuilder(latLongRect_).mergeFrom(value).buildPartial();
} else {
latLongRect_ = value;
}
onChanged();
} else {
latLongRectBuilder_.mergeFrom(value);
}
return this;
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public Builder clearLatLongRect() {
if (latLongRectBuilder_ == null) {
latLongRect_ = null;
onChanged();
} else {
latLongRect_ = null;
latLongRectBuilder_ = null;
}
return this;
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public com.google.cloud.vision.v1.LatLongRect.Builder getLatLongRectBuilder() {
onChanged();
return getLatLongRectFieldBuilder().getBuilder();
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
public com.google.cloud.vision.v1.LatLongRectOrBuilder getLatLongRectOrBuilder() {
if (latLongRectBuilder_ != null) {
return latLongRectBuilder_.getMessageOrBuilder();
} else {
return latLongRect_ == null ?
com.google.cloud.vision.v1.LatLongRect.getDefaultInstance() : latLongRect_;
}
}
/**
*
* Lat/long rectangle that specifies the location of the image.
*
*
* optional .google.cloud.vision.v1.LatLongRect lat_long_rect = 1;
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.vision.v1.LatLongRect, com.google.cloud.vision.v1.LatLongRect.Builder, com.google.cloud.vision.v1.LatLongRectOrBuilder>
getLatLongRectFieldBuilder() {
if (latLongRectBuilder_ == null) {
latLongRectBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.vision.v1.LatLongRect, com.google.cloud.vision.v1.LatLongRect.Builder, com.google.cloud.vision.v1.LatLongRectOrBuilder>(
getLatLongRect(),
getParentForChildren(),
isClean());
latLongRect_ = null;
}
return latLongRectBuilder_;
}
private com.google.protobuf.LazyStringList languageHints_ = com.google.protobuf.LazyStringArrayList.EMPTY;
private void ensureLanguageHintsIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
languageHints_ = new com.google.protobuf.LazyStringArrayList(languageHints_);
bitField0_ |= 0x00000002;
}
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public com.google.protobuf.ProtocolStringList
getLanguageHintsList() {
return languageHints_.getUnmodifiableView();
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public int getLanguageHintsCount() {
return languageHints_.size();
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public java.lang.String getLanguageHints(int index) {
return languageHints_.get(index);
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public com.google.protobuf.ByteString
getLanguageHintsBytes(int index) {
return languageHints_.getByteString(index);
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public Builder setLanguageHints(
int index, java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureLanguageHintsIsMutable();
languageHints_.set(index, value);
onChanged();
return this;
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public Builder addLanguageHints(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureLanguageHintsIsMutable();
languageHints_.add(value);
onChanged();
return this;
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public Builder addAllLanguageHints(
java.lang.Iterable values) {
ensureLanguageHintsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, languageHints_);
onChanged();
return this;
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public Builder clearLanguageHints() {
languageHints_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
/**
*
* List of languages to use for TEXT_DETECTION. In most cases, an empty value
* yields the best results since it enables automatic language detection. For
* languages based on the Latin alphabet, setting `language_hints` is not
* needed. In rare cases, when the language of the text in the image is known,
* setting a hint will help get better results (although it will be a
* significant hindrance if the hint is wrong). Text detection returns an
* error if one or more of the specified languages is not one of the
* [supported
* languages](/translate/v2/translate-reference#supported_languages).
*
*
* repeated string language_hints = 2;
*/
public Builder addLanguageHintsBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
ensureLanguageHintsIsMutable();
languageHints_.add(value);
onChanged();
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return this;
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return this;
}
// @@protoc_insertion_point(builder_scope:google.cloud.vision.v1.ImageContext)
}
// @@protoc_insertion_point(class_scope:google.cloud.vision.v1.ImageContext)
private static final com.google.cloud.vision.v1.ImageContext DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.vision.v1.ImageContext();
}
public static com.google.cloud.vision.v1.ImageContext getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
public ImageContext parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ImageContext(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
public com.google.cloud.vision.v1.ImageContext getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy