com.google.cloud.vision.v1.Feature 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;
/**
*
* The <em>Feature</em> indicates what type of image detection task to perform.
* Users describe the type of Google Cloud Vision API tasks to perform over
* images by using <em>Feature</em>s. Features encode the Cloud Vision API
* vertical to operate on and the number of top-scoring results to return.
*
*
* Protobuf type {@code google.cloud.vision.v1.Feature}
*/
public final class Feature extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.cloud.vision.v1.Feature)
FeatureOrBuilder {
// Use Feature.newBuilder() to construct.
private Feature(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private Feature() {
type_ = 0;
maxResults_ = 0;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
}
private Feature(
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 8: {
int rawValue = input.readEnum();
type_ = rawValue;
break;
}
case 16: {
maxResults_ = input.readInt32();
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 {
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_Feature_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_Feature_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.vision.v1.Feature.class, com.google.cloud.vision.v1.Feature.Builder.class);
}
/**
*
* Type of image feature.
*
*
* Protobuf enum {@code google.cloud.vision.v1.Feature.Type}
*/
public enum Type
implements com.google.protobuf.ProtocolMessageEnum {
/**
*
* Unspecified feature type.
*
*
* TYPE_UNSPECIFIED = 0;
*/
TYPE_UNSPECIFIED(0),
/**
*
* Run face detection.
*
*
* FACE_DETECTION = 1;
*/
FACE_DETECTION(1),
/**
*
* Run landmark detection.
*
*
* LANDMARK_DETECTION = 2;
*/
LANDMARK_DETECTION(2),
/**
*
* Run logo detection.
*
*
* LOGO_DETECTION = 3;
*/
LOGO_DETECTION(3),
/**
*
* Run label detection.
*
*
* LABEL_DETECTION = 4;
*/
LABEL_DETECTION(4),
/**
*
* Run OCR.
*
*
* TEXT_DETECTION = 5;
*/
TEXT_DETECTION(5),
/**
*
* Run various computer vision models to compute image safe-search properties.
*
*
* SAFE_SEARCH_DETECTION = 6;
*/
SAFE_SEARCH_DETECTION(6),
/**
*
* Compute a set of properties about the image (such as the image's dominant colors).
*
*
* IMAGE_PROPERTIES = 7;
*/
IMAGE_PROPERTIES(7),
UNRECOGNIZED(-1),
;
/**
*
* Unspecified feature type.
*
*
* TYPE_UNSPECIFIED = 0;
*/
public static final int TYPE_UNSPECIFIED_VALUE = 0;
/**
*
* Run face detection.
*
*
* FACE_DETECTION = 1;
*/
public static final int FACE_DETECTION_VALUE = 1;
/**
*
* Run landmark detection.
*
*
* LANDMARK_DETECTION = 2;
*/
public static final int LANDMARK_DETECTION_VALUE = 2;
/**
*
* Run logo detection.
*
*
* LOGO_DETECTION = 3;
*/
public static final int LOGO_DETECTION_VALUE = 3;
/**
*
* Run label detection.
*
*
* LABEL_DETECTION = 4;
*/
public static final int LABEL_DETECTION_VALUE = 4;
/**
*
* Run OCR.
*
*
* TEXT_DETECTION = 5;
*/
public static final int TEXT_DETECTION_VALUE = 5;
/**
*
* Run various computer vision models to compute image safe-search properties.
*
*
* SAFE_SEARCH_DETECTION = 6;
*/
public static final int SAFE_SEARCH_DETECTION_VALUE = 6;
/**
*
* Compute a set of properties about the image (such as the image's dominant colors).
*
*
* IMAGE_PROPERTIES = 7;
*/
public static final int IMAGE_PROPERTIES_VALUE = 7;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static Type valueOf(int value) {
return forNumber(value);
}
public static Type forNumber(int value) {
switch (value) {
case 0: return TYPE_UNSPECIFIED;
case 1: return FACE_DETECTION;
case 2: return LANDMARK_DETECTION;
case 3: return LOGO_DETECTION;
case 4: return LABEL_DETECTION;
case 5: return TEXT_DETECTION;
case 6: return SAFE_SEARCH_DETECTION;
case 7: return IMAGE_PROPERTIES;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
Type> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap() {
public Type findValueByNumber(int number) {
return Type.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return com.google.cloud.vision.v1.Feature.getDescriptor().getEnumTypes().get(0);
}
private static final Type[] VALUES = values();
public static Type valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private Type(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:google.cloud.vision.v1.Feature.Type)
}
public static final int TYPE_FIELD_NUMBER = 1;
private int type_;
/**
*
* The feature type.
*
*
* optional .google.cloud.vision.v1.Feature.Type type = 1;
*/
public int getTypeValue() {
return type_;
}
/**
*
* The feature type.
*
*
* optional .google.cloud.vision.v1.Feature.Type type = 1;
*/
public com.google.cloud.vision.v1.Feature.Type getType() {
com.google.cloud.vision.v1.Feature.Type result = com.google.cloud.vision.v1.Feature.Type.valueOf(type_);
return result == null ? com.google.cloud.vision.v1.Feature.Type.UNRECOGNIZED : result;
}
public static final int MAX_RESULTS_FIELD_NUMBER = 2;
private int maxResults_;
/**
*
* Maximum number of results of this type.
*
*
* optional int32 max_results = 2;
*/
public int getMaxResults() {
return maxResults_;
}
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 (type_ != com.google.cloud.vision.v1.Feature.Type.TYPE_UNSPECIFIED.getNumber()) {
output.writeEnum(1, type_);
}
if (maxResults_ != 0) {
output.writeInt32(2, maxResults_);
}
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (type_ != com.google.cloud.vision.v1.Feature.Type.TYPE_UNSPECIFIED.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(1, type_);
}
if (maxResults_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, maxResults_);
}
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.Feature)) {
return super.equals(obj);
}
com.google.cloud.vision.v1.Feature other = (com.google.cloud.vision.v1.Feature) obj;
boolean result = true;
result = result && type_ == other.type_;
result = result && (getMaxResults()
== other.getMaxResults());
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptorForType().hashCode();
hash = (37 * hash) + TYPE_FIELD_NUMBER;
hash = (53 * hash) + type_;
hash = (37 * hash) + MAX_RESULTS_FIELD_NUMBER;
hash = (53 * hash) + getMaxResults();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.vision.v1.Feature parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.vision.v1.Feature 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.Feature parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.vision.v1.Feature 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.Feature parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1.Feature 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.Feature parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1.Feature 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.Feature 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.Feature 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.Feature 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;
}
/**
*
* The <em>Feature</em> indicates what type of image detection task to perform.
* Users describe the type of Google Cloud Vision API tasks to perform over
* images by using <em>Feature</em>s. Features encode the Cloud Vision API
* vertical to operate on and the number of top-scoring results to return.
*
*
* Protobuf type {@code google.cloud.vision.v1.Feature}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:google.cloud.vision.v1.Feature)
com.google.cloud.vision.v1.FeatureOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_Feature_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_Feature_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.vision.v1.Feature.class, com.google.cloud.vision.v1.Feature.Builder.class);
}
// Construct using com.google.cloud.vision.v1.Feature.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();
type_ = 0;
maxResults_ = 0;
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.cloud.vision.v1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1_Feature_descriptor;
}
public com.google.cloud.vision.v1.Feature getDefaultInstanceForType() {
return com.google.cloud.vision.v1.Feature.getDefaultInstance();
}
public com.google.cloud.vision.v1.Feature build() {
com.google.cloud.vision.v1.Feature result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.google.cloud.vision.v1.Feature buildPartial() {
com.google.cloud.vision.v1.Feature result = new com.google.cloud.vision.v1.Feature(this);
result.type_ = type_;
result.maxResults_ = maxResults_;
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.Feature) {
return mergeFrom((com.google.cloud.vision.v1.Feature)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.vision.v1.Feature other) {
if (other == com.google.cloud.vision.v1.Feature.getDefaultInstance()) return this;
if (other.type_ != 0) {
setTypeValue(other.getTypeValue());
}
if (other.getMaxResults() != 0) {
setMaxResults(other.getMaxResults());
}
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.Feature parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.cloud.vision.v1.Feature) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int type_ = 0;
/**
*
* The feature type.
*
*
* optional .google.cloud.vision.v1.Feature.Type type = 1;
*/
public int getTypeValue() {
return type_;
}
/**
*
* The feature type.
*
*
* optional .google.cloud.vision.v1.Feature.Type type = 1;
*/
public Builder setTypeValue(int value) {
type_ = value;
onChanged();
return this;
}
/**
*
* The feature type.
*
*
* optional .google.cloud.vision.v1.Feature.Type type = 1;
*/
public com.google.cloud.vision.v1.Feature.Type getType() {
com.google.cloud.vision.v1.Feature.Type result = com.google.cloud.vision.v1.Feature.Type.valueOf(type_);
return result == null ? com.google.cloud.vision.v1.Feature.Type.UNRECOGNIZED : result;
}
/**
*
* The feature type.
*
*
* optional .google.cloud.vision.v1.Feature.Type type = 1;
*/
public Builder setType(com.google.cloud.vision.v1.Feature.Type value) {
if (value == null) {
throw new NullPointerException();
}
type_ = value.getNumber();
onChanged();
return this;
}
/**
*
* The feature type.
*
*
* optional .google.cloud.vision.v1.Feature.Type type = 1;
*/
public Builder clearType() {
type_ = 0;
onChanged();
return this;
}
private int maxResults_ ;
/**
*
* Maximum number of results of this type.
*
*
* optional int32 max_results = 2;
*/
public int getMaxResults() {
return maxResults_;
}
/**
*
* Maximum number of results of this type.
*
*
* optional int32 max_results = 2;
*/
public Builder setMaxResults(int value) {
maxResults_ = value;
onChanged();
return this;
}
/**
*
* Maximum number of results of this type.
*
*
* optional int32 max_results = 2;
*/
public Builder clearMaxResults() {
maxResults_ = 0;
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.Feature)
}
// @@protoc_insertion_point(class_scope:google.cloud.vision.v1.Feature)
private static final com.google.cloud.vision.v1.Feature DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.vision.v1.Feature();
}
public static com.google.cloud.vision.v1.Feature getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
public Feature parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Feature(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.Feature getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy