• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 // Generated by the protocol buffer compiler.  DO NOT EDIT!
17 // source: google/cloud/vision/v1p2beta1/image_annotator.proto
18 
19 package com.google.cloud.vision.v1p2beta1;
20 
21 /**
22  *
23  *
24  * <pre>
25  * The type of Google Cloud Vision API detection to perform, and the maximum
26  * number of results to return for that type. Multiple `Feature` objects can
27  * be specified in the `features` list.
28  * </pre>
29  *
30  * Protobuf type {@code google.cloud.vision.v1p2beta1.Feature}
31  */
32 public final class Feature extends com.google.protobuf.GeneratedMessageV3
33     implements
34     // @@protoc_insertion_point(message_implements:google.cloud.vision.v1p2beta1.Feature)
35     FeatureOrBuilder {
36   private static final long serialVersionUID = 0L;
37   // Use Feature.newBuilder() to construct.
Feature(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)38   private Feature(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
39     super(builder);
40   }
41 
Feature()42   private Feature() {
43     type_ = 0;
44     model_ = "";
45   }
46 
47   @java.lang.Override
48   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)49   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
50     return new Feature();
51   }
52 
53   @java.lang.Override
getUnknownFields()54   public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
55     return this.unknownFields;
56   }
57 
getDescriptor()58   public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
59     return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto
60         .internal_static_google_cloud_vision_v1p2beta1_Feature_descriptor;
61   }
62 
63   @java.lang.Override
64   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()65       internalGetFieldAccessorTable() {
66     return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto
67         .internal_static_google_cloud_vision_v1p2beta1_Feature_fieldAccessorTable
68         .ensureFieldAccessorsInitialized(
69             com.google.cloud.vision.v1p2beta1.Feature.class,
70             com.google.cloud.vision.v1p2beta1.Feature.Builder.class);
71   }
72 
73   /**
74    *
75    *
76    * <pre>
77    * Type of Google Cloud Vision API feature to be extracted.
78    * </pre>
79    *
80    * Protobuf enum {@code google.cloud.vision.v1p2beta1.Feature.Type}
81    */
82   public enum Type implements com.google.protobuf.ProtocolMessageEnum {
83     /**
84      *
85      *
86      * <pre>
87      * Unspecified feature type.
88      * </pre>
89      *
90      * <code>TYPE_UNSPECIFIED = 0;</code>
91      */
92     TYPE_UNSPECIFIED(0),
93     /**
94      *
95      *
96      * <pre>
97      * Run face detection.
98      * </pre>
99      *
100      * <code>FACE_DETECTION = 1;</code>
101      */
102     FACE_DETECTION(1),
103     /**
104      *
105      *
106      * <pre>
107      * Run landmark detection.
108      * </pre>
109      *
110      * <code>LANDMARK_DETECTION = 2;</code>
111      */
112     LANDMARK_DETECTION(2),
113     /**
114      *
115      *
116      * <pre>
117      * Run logo detection.
118      * </pre>
119      *
120      * <code>LOGO_DETECTION = 3;</code>
121      */
122     LOGO_DETECTION(3),
123     /**
124      *
125      *
126      * <pre>
127      * Run label detection.
128      * </pre>
129      *
130      * <code>LABEL_DETECTION = 4;</code>
131      */
132     LABEL_DETECTION(4),
133     /**
134      *
135      *
136      * <pre>
137      * Run text detection / optical character recognition (OCR). Text detection
138      * is optimized for areas of text within a larger image; if the image is
139      * a document, use `DOCUMENT_TEXT_DETECTION` instead.
140      * </pre>
141      *
142      * <code>TEXT_DETECTION = 5;</code>
143      */
144     TEXT_DETECTION(5),
145     /**
146      *
147      *
148      * <pre>
149      * Run dense text document OCR. Takes precedence when both
150      * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present.
151      * </pre>
152      *
153      * <code>DOCUMENT_TEXT_DETECTION = 11;</code>
154      */
155     DOCUMENT_TEXT_DETECTION(11),
156     /**
157      *
158      *
159      * <pre>
160      * Run Safe Search to detect potentially unsafe
161      * or undesirable content.
162      * </pre>
163      *
164      * <code>SAFE_SEARCH_DETECTION = 6;</code>
165      */
166     SAFE_SEARCH_DETECTION(6),
167     /**
168      *
169      *
170      * <pre>
171      * Compute a set of image properties, such as the
172      * image's dominant colors.
173      * </pre>
174      *
175      * <code>IMAGE_PROPERTIES = 7;</code>
176      */
177     IMAGE_PROPERTIES(7),
178     /**
179      *
180      *
181      * <pre>
182      * Run crop hints.
183      * </pre>
184      *
185      * <code>CROP_HINTS = 9;</code>
186      */
187     CROP_HINTS(9),
188     /**
189      *
190      *
191      * <pre>
192      * Run web detection.
193      * </pre>
194      *
195      * <code>WEB_DETECTION = 10;</code>
196      */
197     WEB_DETECTION(10),
198     UNRECOGNIZED(-1),
199     ;
200 
201     /**
202      *
203      *
204      * <pre>
205      * Unspecified feature type.
206      * </pre>
207      *
208      * <code>TYPE_UNSPECIFIED = 0;</code>
209      */
210     public static final int TYPE_UNSPECIFIED_VALUE = 0;
211     /**
212      *
213      *
214      * <pre>
215      * Run face detection.
216      * </pre>
217      *
218      * <code>FACE_DETECTION = 1;</code>
219      */
220     public static final int FACE_DETECTION_VALUE = 1;
221     /**
222      *
223      *
224      * <pre>
225      * Run landmark detection.
226      * </pre>
227      *
228      * <code>LANDMARK_DETECTION = 2;</code>
229      */
230     public static final int LANDMARK_DETECTION_VALUE = 2;
231     /**
232      *
233      *
234      * <pre>
235      * Run logo detection.
236      * </pre>
237      *
238      * <code>LOGO_DETECTION = 3;</code>
239      */
240     public static final int LOGO_DETECTION_VALUE = 3;
241     /**
242      *
243      *
244      * <pre>
245      * Run label detection.
246      * </pre>
247      *
248      * <code>LABEL_DETECTION = 4;</code>
249      */
250     public static final int LABEL_DETECTION_VALUE = 4;
251     /**
252      *
253      *
254      * <pre>
255      * Run text detection / optical character recognition (OCR). Text detection
256      * is optimized for areas of text within a larger image; if the image is
257      * a document, use `DOCUMENT_TEXT_DETECTION` instead.
258      * </pre>
259      *
260      * <code>TEXT_DETECTION = 5;</code>
261      */
262     public static final int TEXT_DETECTION_VALUE = 5;
263     /**
264      *
265      *
266      * <pre>
267      * Run dense text document OCR. Takes precedence when both
268      * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present.
269      * </pre>
270      *
271      * <code>DOCUMENT_TEXT_DETECTION = 11;</code>
272      */
273     public static final int DOCUMENT_TEXT_DETECTION_VALUE = 11;
274     /**
275      *
276      *
277      * <pre>
278      * Run Safe Search to detect potentially unsafe
279      * or undesirable content.
280      * </pre>
281      *
282      * <code>SAFE_SEARCH_DETECTION = 6;</code>
283      */
284     public static final int SAFE_SEARCH_DETECTION_VALUE = 6;
285     /**
286      *
287      *
288      * <pre>
289      * Compute a set of image properties, such as the
290      * image's dominant colors.
291      * </pre>
292      *
293      * <code>IMAGE_PROPERTIES = 7;</code>
294      */
295     public static final int IMAGE_PROPERTIES_VALUE = 7;
296     /**
297      *
298      *
299      * <pre>
300      * Run crop hints.
301      * </pre>
302      *
303      * <code>CROP_HINTS = 9;</code>
304      */
305     public static final int CROP_HINTS_VALUE = 9;
306     /**
307      *
308      *
309      * <pre>
310      * Run web detection.
311      * </pre>
312      *
313      * <code>WEB_DETECTION = 10;</code>
314      */
315     public static final int WEB_DETECTION_VALUE = 10;
316 
getNumber()317     public final int getNumber() {
318       if (this == UNRECOGNIZED) {
319         throw new java.lang.IllegalArgumentException(
320             "Can't get the number of an unknown enum value.");
321       }
322       return value;
323     }
324 
325     /**
326      * @param value The numeric wire value of the corresponding enum entry.
327      * @return The enum associated with the given numeric wire value.
328      * @deprecated Use {@link #forNumber(int)} instead.
329      */
330     @java.lang.Deprecated
valueOf(int value)331     public static Type valueOf(int value) {
332       return forNumber(value);
333     }
334 
335     /**
336      * @param value The numeric wire value of the corresponding enum entry.
337      * @return The enum associated with the given numeric wire value.
338      */
forNumber(int value)339     public static Type forNumber(int value) {
340       switch (value) {
341         case 0:
342           return TYPE_UNSPECIFIED;
343         case 1:
344           return FACE_DETECTION;
345         case 2:
346           return LANDMARK_DETECTION;
347         case 3:
348           return LOGO_DETECTION;
349         case 4:
350           return LABEL_DETECTION;
351         case 5:
352           return TEXT_DETECTION;
353         case 11:
354           return DOCUMENT_TEXT_DETECTION;
355         case 6:
356           return SAFE_SEARCH_DETECTION;
357         case 7:
358           return IMAGE_PROPERTIES;
359         case 9:
360           return CROP_HINTS;
361         case 10:
362           return WEB_DETECTION;
363         default:
364           return null;
365       }
366     }
367 
internalGetValueMap()368     public static com.google.protobuf.Internal.EnumLiteMap<Type> internalGetValueMap() {
369       return internalValueMap;
370     }
371 
372     private static final com.google.protobuf.Internal.EnumLiteMap<Type> internalValueMap =
373         new com.google.protobuf.Internal.EnumLiteMap<Type>() {
374           public Type findValueByNumber(int number) {
375             return Type.forNumber(number);
376           }
377         };
378 
getValueDescriptor()379     public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
380       if (this == UNRECOGNIZED) {
381         throw new java.lang.IllegalStateException(
382             "Can't get the descriptor of an unrecognized enum value.");
383       }
384       return getDescriptor().getValues().get(ordinal());
385     }
386 
getDescriptorForType()387     public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
388       return getDescriptor();
389     }
390 
getDescriptor()391     public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
392       return com.google.cloud.vision.v1p2beta1.Feature.getDescriptor().getEnumTypes().get(0);
393     }
394 
395     private static final Type[] VALUES = values();
396 
valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)397     public static Type valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
398       if (desc.getType() != getDescriptor()) {
399         throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
400       }
401       if (desc.getIndex() == -1) {
402         return UNRECOGNIZED;
403       }
404       return VALUES[desc.getIndex()];
405     }
406 
407     private final int value;
408 
Type(int value)409     private Type(int value) {
410       this.value = value;
411     }
412 
413     // @@protoc_insertion_point(enum_scope:google.cloud.vision.v1p2beta1.Feature.Type)
414   }
415 
416   public static final int TYPE_FIELD_NUMBER = 1;
417   private int type_ = 0;
418   /**
419    *
420    *
421    * <pre>
422    * The feature type.
423    * </pre>
424    *
425    * <code>.google.cloud.vision.v1p2beta1.Feature.Type type = 1;</code>
426    *
427    * @return The enum numeric value on the wire for type.
428    */
429   @java.lang.Override
getTypeValue()430   public int getTypeValue() {
431     return type_;
432   }
433   /**
434    *
435    *
436    * <pre>
437    * The feature type.
438    * </pre>
439    *
440    * <code>.google.cloud.vision.v1p2beta1.Feature.Type type = 1;</code>
441    *
442    * @return The type.
443    */
444   @java.lang.Override
getType()445   public com.google.cloud.vision.v1p2beta1.Feature.Type getType() {
446     com.google.cloud.vision.v1p2beta1.Feature.Type result =
447         com.google.cloud.vision.v1p2beta1.Feature.Type.forNumber(type_);
448     return result == null ? com.google.cloud.vision.v1p2beta1.Feature.Type.UNRECOGNIZED : result;
449   }
450 
451   public static final int MAX_RESULTS_FIELD_NUMBER = 2;
452   private int maxResults_ = 0;
453   /**
454    *
455    *
456    * <pre>
457    * Maximum number of results of this type. Does not apply to
458    * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
459    * </pre>
460    *
461    * <code>int32 max_results = 2;</code>
462    *
463    * @return The maxResults.
464    */
465   @java.lang.Override
getMaxResults()466   public int getMaxResults() {
467     return maxResults_;
468   }
469 
470   public static final int MODEL_FIELD_NUMBER = 3;
471 
472   @SuppressWarnings("serial")
473   private volatile java.lang.Object model_ = "";
474   /**
475    *
476    *
477    * <pre>
478    * Model to use for the feature.
479    * Supported values: "builtin/stable" (the default if unset) and
480    * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
481    * support "builtin/weekly" for the bleeding edge release updated weekly.
482    * </pre>
483    *
484    * <code>string model = 3;</code>
485    *
486    * @return The model.
487    */
488   @java.lang.Override
getModel()489   public java.lang.String getModel() {
490     java.lang.Object ref = model_;
491     if (ref instanceof java.lang.String) {
492       return (java.lang.String) ref;
493     } else {
494       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
495       java.lang.String s = bs.toStringUtf8();
496       model_ = s;
497       return s;
498     }
499   }
500   /**
501    *
502    *
503    * <pre>
504    * Model to use for the feature.
505    * Supported values: "builtin/stable" (the default if unset) and
506    * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
507    * support "builtin/weekly" for the bleeding edge release updated weekly.
508    * </pre>
509    *
510    * <code>string model = 3;</code>
511    *
512    * @return The bytes for model.
513    */
514   @java.lang.Override
getModelBytes()515   public com.google.protobuf.ByteString getModelBytes() {
516     java.lang.Object ref = model_;
517     if (ref instanceof java.lang.String) {
518       com.google.protobuf.ByteString b =
519           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
520       model_ = b;
521       return b;
522     } else {
523       return (com.google.protobuf.ByteString) ref;
524     }
525   }
526 
527   private byte memoizedIsInitialized = -1;
528 
529   @java.lang.Override
isInitialized()530   public final boolean isInitialized() {
531     byte isInitialized = memoizedIsInitialized;
532     if (isInitialized == 1) return true;
533     if (isInitialized == 0) return false;
534 
535     memoizedIsInitialized = 1;
536     return true;
537   }
538 
539   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)540   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
541     if (type_ != com.google.cloud.vision.v1p2beta1.Feature.Type.TYPE_UNSPECIFIED.getNumber()) {
542       output.writeEnum(1, type_);
543     }
544     if (maxResults_ != 0) {
545       output.writeInt32(2, maxResults_);
546     }
547     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(model_)) {
548       com.google.protobuf.GeneratedMessageV3.writeString(output, 3, model_);
549     }
550     getUnknownFields().writeTo(output);
551   }
552 
553   @java.lang.Override
getSerializedSize()554   public int getSerializedSize() {
555     int size = memoizedSize;
556     if (size != -1) return size;
557 
558     size = 0;
559     if (type_ != com.google.cloud.vision.v1p2beta1.Feature.Type.TYPE_UNSPECIFIED.getNumber()) {
560       size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, type_);
561     }
562     if (maxResults_ != 0) {
563       size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, maxResults_);
564     }
565     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(model_)) {
566       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, model_);
567     }
568     size += getUnknownFields().getSerializedSize();
569     memoizedSize = size;
570     return size;
571   }
572 
573   @java.lang.Override
equals(final java.lang.Object obj)574   public boolean equals(final java.lang.Object obj) {
575     if (obj == this) {
576       return true;
577     }
578     if (!(obj instanceof com.google.cloud.vision.v1p2beta1.Feature)) {
579       return super.equals(obj);
580     }
581     com.google.cloud.vision.v1p2beta1.Feature other =
582         (com.google.cloud.vision.v1p2beta1.Feature) obj;
583 
584     if (type_ != other.type_) return false;
585     if (getMaxResults() != other.getMaxResults()) return false;
586     if (!getModel().equals(other.getModel())) return false;
587     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
588     return true;
589   }
590 
591   @java.lang.Override
hashCode()592   public int hashCode() {
593     if (memoizedHashCode != 0) {
594       return memoizedHashCode;
595     }
596     int hash = 41;
597     hash = (19 * hash) + getDescriptor().hashCode();
598     hash = (37 * hash) + TYPE_FIELD_NUMBER;
599     hash = (53 * hash) + type_;
600     hash = (37 * hash) + MAX_RESULTS_FIELD_NUMBER;
601     hash = (53 * hash) + getMaxResults();
602     hash = (37 * hash) + MODEL_FIELD_NUMBER;
603     hash = (53 * hash) + getModel().hashCode();
604     hash = (29 * hash) + getUnknownFields().hashCode();
605     memoizedHashCode = hash;
606     return hash;
607   }
608 
parseFrom(java.nio.ByteBuffer data)609   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(java.nio.ByteBuffer data)
610       throws com.google.protobuf.InvalidProtocolBufferException {
611     return PARSER.parseFrom(data);
612   }
613 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)614   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(
615       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
616       throws com.google.protobuf.InvalidProtocolBufferException {
617     return PARSER.parseFrom(data, extensionRegistry);
618   }
619 
parseFrom( com.google.protobuf.ByteString data)620   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(
621       com.google.protobuf.ByteString data)
622       throws com.google.protobuf.InvalidProtocolBufferException {
623     return PARSER.parseFrom(data);
624   }
625 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)626   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(
627       com.google.protobuf.ByteString data,
628       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
629       throws com.google.protobuf.InvalidProtocolBufferException {
630     return PARSER.parseFrom(data, extensionRegistry);
631   }
632 
parseFrom(byte[] data)633   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(byte[] data)
634       throws com.google.protobuf.InvalidProtocolBufferException {
635     return PARSER.parseFrom(data);
636   }
637 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)638   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(
639       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
640       throws com.google.protobuf.InvalidProtocolBufferException {
641     return PARSER.parseFrom(data, extensionRegistry);
642   }
643 
parseFrom(java.io.InputStream input)644   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(java.io.InputStream input)
645       throws java.io.IOException {
646     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
647   }
648 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)649   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(
650       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
651       throws java.io.IOException {
652     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
653         PARSER, input, extensionRegistry);
654   }
655 
parseDelimitedFrom( java.io.InputStream input)656   public static com.google.cloud.vision.v1p2beta1.Feature parseDelimitedFrom(
657       java.io.InputStream input) throws java.io.IOException {
658     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
659   }
660 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)661   public static com.google.cloud.vision.v1p2beta1.Feature parseDelimitedFrom(
662       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
663       throws java.io.IOException {
664     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
665         PARSER, input, extensionRegistry);
666   }
667 
parseFrom( com.google.protobuf.CodedInputStream input)668   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(
669       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
670     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
671   }
672 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)673   public static com.google.cloud.vision.v1p2beta1.Feature parseFrom(
674       com.google.protobuf.CodedInputStream input,
675       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
676       throws java.io.IOException {
677     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
678         PARSER, input, extensionRegistry);
679   }
680 
681   @java.lang.Override
newBuilderForType()682   public Builder newBuilderForType() {
683     return newBuilder();
684   }
685 
newBuilder()686   public static Builder newBuilder() {
687     return DEFAULT_INSTANCE.toBuilder();
688   }
689 
newBuilder(com.google.cloud.vision.v1p2beta1.Feature prototype)690   public static Builder newBuilder(com.google.cloud.vision.v1p2beta1.Feature prototype) {
691     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
692   }
693 
694   @java.lang.Override
toBuilder()695   public Builder toBuilder() {
696     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
697   }
698 
699   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)700   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
701     Builder builder = new Builder(parent);
702     return builder;
703   }
704   /**
705    *
706    *
707    * <pre>
708    * The type of Google Cloud Vision API detection to perform, and the maximum
709    * number of results to return for that type. Multiple `Feature` objects can
710    * be specified in the `features` list.
711    * </pre>
712    *
713    * Protobuf type {@code google.cloud.vision.v1p2beta1.Feature}
714    */
715   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
716       implements
717       // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1p2beta1.Feature)
718       com.google.cloud.vision.v1p2beta1.FeatureOrBuilder {
getDescriptor()719     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
720       return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto
721           .internal_static_google_cloud_vision_v1p2beta1_Feature_descriptor;
722     }
723 
724     @java.lang.Override
725     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()726         internalGetFieldAccessorTable() {
727       return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto
728           .internal_static_google_cloud_vision_v1p2beta1_Feature_fieldAccessorTable
729           .ensureFieldAccessorsInitialized(
730               com.google.cloud.vision.v1p2beta1.Feature.class,
731               com.google.cloud.vision.v1p2beta1.Feature.Builder.class);
732     }
733 
734     // Construct using com.google.cloud.vision.v1p2beta1.Feature.newBuilder()
Builder()735     private Builder() {}
736 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)737     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
738       super(parent);
739     }
740 
741     @java.lang.Override
clear()742     public Builder clear() {
743       super.clear();
744       bitField0_ = 0;
745       type_ = 0;
746       maxResults_ = 0;
747       model_ = "";
748       return this;
749     }
750 
751     @java.lang.Override
getDescriptorForType()752     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
753       return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto
754           .internal_static_google_cloud_vision_v1p2beta1_Feature_descriptor;
755     }
756 
757     @java.lang.Override
getDefaultInstanceForType()758     public com.google.cloud.vision.v1p2beta1.Feature getDefaultInstanceForType() {
759       return com.google.cloud.vision.v1p2beta1.Feature.getDefaultInstance();
760     }
761 
762     @java.lang.Override
build()763     public com.google.cloud.vision.v1p2beta1.Feature build() {
764       com.google.cloud.vision.v1p2beta1.Feature result = buildPartial();
765       if (!result.isInitialized()) {
766         throw newUninitializedMessageException(result);
767       }
768       return result;
769     }
770 
771     @java.lang.Override
buildPartial()772     public com.google.cloud.vision.v1p2beta1.Feature buildPartial() {
773       com.google.cloud.vision.v1p2beta1.Feature result =
774           new com.google.cloud.vision.v1p2beta1.Feature(this);
775       if (bitField0_ != 0) {
776         buildPartial0(result);
777       }
778       onBuilt();
779       return result;
780     }
781 
buildPartial0(com.google.cloud.vision.v1p2beta1.Feature result)782     private void buildPartial0(com.google.cloud.vision.v1p2beta1.Feature result) {
783       int from_bitField0_ = bitField0_;
784       if (((from_bitField0_ & 0x00000001) != 0)) {
785         result.type_ = type_;
786       }
787       if (((from_bitField0_ & 0x00000002) != 0)) {
788         result.maxResults_ = maxResults_;
789       }
790       if (((from_bitField0_ & 0x00000004) != 0)) {
791         result.model_ = model_;
792       }
793     }
794 
795     @java.lang.Override
clone()796     public Builder clone() {
797       return super.clone();
798     }
799 
800     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)801     public Builder setField(
802         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
803       return super.setField(field, value);
804     }
805 
806     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)807     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
808       return super.clearField(field);
809     }
810 
811     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)812     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
813       return super.clearOneof(oneof);
814     }
815 
816     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)817     public Builder setRepeatedField(
818         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
819       return super.setRepeatedField(field, index, value);
820     }
821 
822     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)823     public Builder addRepeatedField(
824         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
825       return super.addRepeatedField(field, value);
826     }
827 
828     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)829     public Builder mergeFrom(com.google.protobuf.Message other) {
830       if (other instanceof com.google.cloud.vision.v1p2beta1.Feature) {
831         return mergeFrom((com.google.cloud.vision.v1p2beta1.Feature) other);
832       } else {
833         super.mergeFrom(other);
834         return this;
835       }
836     }
837 
mergeFrom(com.google.cloud.vision.v1p2beta1.Feature other)838     public Builder mergeFrom(com.google.cloud.vision.v1p2beta1.Feature other) {
839       if (other == com.google.cloud.vision.v1p2beta1.Feature.getDefaultInstance()) return this;
840       if (other.type_ != 0) {
841         setTypeValue(other.getTypeValue());
842       }
843       if (other.getMaxResults() != 0) {
844         setMaxResults(other.getMaxResults());
845       }
846       if (!other.getModel().isEmpty()) {
847         model_ = other.model_;
848         bitField0_ |= 0x00000004;
849         onChanged();
850       }
851       this.mergeUnknownFields(other.getUnknownFields());
852       onChanged();
853       return this;
854     }
855 
856     @java.lang.Override
isInitialized()857     public final boolean isInitialized() {
858       return true;
859     }
860 
861     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)862     public Builder mergeFrom(
863         com.google.protobuf.CodedInputStream input,
864         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
865         throws java.io.IOException {
866       if (extensionRegistry == null) {
867         throw new java.lang.NullPointerException();
868       }
869       try {
870         boolean done = false;
871         while (!done) {
872           int tag = input.readTag();
873           switch (tag) {
874             case 0:
875               done = true;
876               break;
877             case 8:
878               {
879                 type_ = input.readEnum();
880                 bitField0_ |= 0x00000001;
881                 break;
882               } // case 8
883             case 16:
884               {
885                 maxResults_ = input.readInt32();
886                 bitField0_ |= 0x00000002;
887                 break;
888               } // case 16
889             case 26:
890               {
891                 model_ = input.readStringRequireUtf8();
892                 bitField0_ |= 0x00000004;
893                 break;
894               } // case 26
895             default:
896               {
897                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
898                   done = true; // was an endgroup tag
899                 }
900                 break;
901               } // default:
902           } // switch (tag)
903         } // while (!done)
904       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
905         throw e.unwrapIOException();
906       } finally {
907         onChanged();
908       } // finally
909       return this;
910     }
911 
912     private int bitField0_;
913 
914     private int type_ = 0;
915     /**
916      *
917      *
918      * <pre>
919      * The feature type.
920      * </pre>
921      *
922      * <code>.google.cloud.vision.v1p2beta1.Feature.Type type = 1;</code>
923      *
924      * @return The enum numeric value on the wire for type.
925      */
926     @java.lang.Override
getTypeValue()927     public int getTypeValue() {
928       return type_;
929     }
930     /**
931      *
932      *
933      * <pre>
934      * The feature type.
935      * </pre>
936      *
937      * <code>.google.cloud.vision.v1p2beta1.Feature.Type type = 1;</code>
938      *
939      * @param value The enum numeric value on the wire for type to set.
940      * @return This builder for chaining.
941      */
setTypeValue(int value)942     public Builder setTypeValue(int value) {
943       type_ = value;
944       bitField0_ |= 0x00000001;
945       onChanged();
946       return this;
947     }
948     /**
949      *
950      *
951      * <pre>
952      * The feature type.
953      * </pre>
954      *
955      * <code>.google.cloud.vision.v1p2beta1.Feature.Type type = 1;</code>
956      *
957      * @return The type.
958      */
959     @java.lang.Override
getType()960     public com.google.cloud.vision.v1p2beta1.Feature.Type getType() {
961       com.google.cloud.vision.v1p2beta1.Feature.Type result =
962           com.google.cloud.vision.v1p2beta1.Feature.Type.forNumber(type_);
963       return result == null ? com.google.cloud.vision.v1p2beta1.Feature.Type.UNRECOGNIZED : result;
964     }
965     /**
966      *
967      *
968      * <pre>
969      * The feature type.
970      * </pre>
971      *
972      * <code>.google.cloud.vision.v1p2beta1.Feature.Type type = 1;</code>
973      *
974      * @param value The type to set.
975      * @return This builder for chaining.
976      */
setType(com.google.cloud.vision.v1p2beta1.Feature.Type value)977     public Builder setType(com.google.cloud.vision.v1p2beta1.Feature.Type value) {
978       if (value == null) {
979         throw new NullPointerException();
980       }
981       bitField0_ |= 0x00000001;
982       type_ = value.getNumber();
983       onChanged();
984       return this;
985     }
986     /**
987      *
988      *
989      * <pre>
990      * The feature type.
991      * </pre>
992      *
993      * <code>.google.cloud.vision.v1p2beta1.Feature.Type type = 1;</code>
994      *
995      * @return This builder for chaining.
996      */
clearType()997     public Builder clearType() {
998       bitField0_ = (bitField0_ & ~0x00000001);
999       type_ = 0;
1000       onChanged();
1001       return this;
1002     }
1003 
1004     private int maxResults_;
1005     /**
1006      *
1007      *
1008      * <pre>
1009      * Maximum number of results of this type. Does not apply to
1010      * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
1011      * </pre>
1012      *
1013      * <code>int32 max_results = 2;</code>
1014      *
1015      * @return The maxResults.
1016      */
1017     @java.lang.Override
getMaxResults()1018     public int getMaxResults() {
1019       return maxResults_;
1020     }
1021     /**
1022      *
1023      *
1024      * <pre>
1025      * Maximum number of results of this type. Does not apply to
1026      * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
1027      * </pre>
1028      *
1029      * <code>int32 max_results = 2;</code>
1030      *
1031      * @param value The maxResults to set.
1032      * @return This builder for chaining.
1033      */
setMaxResults(int value)1034     public Builder setMaxResults(int value) {
1035 
1036       maxResults_ = value;
1037       bitField0_ |= 0x00000002;
1038       onChanged();
1039       return this;
1040     }
1041     /**
1042      *
1043      *
1044      * <pre>
1045      * Maximum number of results of this type. Does not apply to
1046      * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
1047      * </pre>
1048      *
1049      * <code>int32 max_results = 2;</code>
1050      *
1051      * @return This builder for chaining.
1052      */
clearMaxResults()1053     public Builder clearMaxResults() {
1054       bitField0_ = (bitField0_ & ~0x00000002);
1055       maxResults_ = 0;
1056       onChanged();
1057       return this;
1058     }
1059 
1060     private java.lang.Object model_ = "";
1061     /**
1062      *
1063      *
1064      * <pre>
1065      * Model to use for the feature.
1066      * Supported values: "builtin/stable" (the default if unset) and
1067      * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
1068      * support "builtin/weekly" for the bleeding edge release updated weekly.
1069      * </pre>
1070      *
1071      * <code>string model = 3;</code>
1072      *
1073      * @return The model.
1074      */
getModel()1075     public java.lang.String getModel() {
1076       java.lang.Object ref = model_;
1077       if (!(ref instanceof java.lang.String)) {
1078         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
1079         java.lang.String s = bs.toStringUtf8();
1080         model_ = s;
1081         return s;
1082       } else {
1083         return (java.lang.String) ref;
1084       }
1085     }
1086     /**
1087      *
1088      *
1089      * <pre>
1090      * Model to use for the feature.
1091      * Supported values: "builtin/stable" (the default if unset) and
1092      * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
1093      * support "builtin/weekly" for the bleeding edge release updated weekly.
1094      * </pre>
1095      *
1096      * <code>string model = 3;</code>
1097      *
1098      * @return The bytes for model.
1099      */
getModelBytes()1100     public com.google.protobuf.ByteString getModelBytes() {
1101       java.lang.Object ref = model_;
1102       if (ref instanceof String) {
1103         com.google.protobuf.ByteString b =
1104             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
1105         model_ = b;
1106         return b;
1107       } else {
1108         return (com.google.protobuf.ByteString) ref;
1109       }
1110     }
1111     /**
1112      *
1113      *
1114      * <pre>
1115      * Model to use for the feature.
1116      * Supported values: "builtin/stable" (the default if unset) and
1117      * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
1118      * support "builtin/weekly" for the bleeding edge release updated weekly.
1119      * </pre>
1120      *
1121      * <code>string model = 3;</code>
1122      *
1123      * @param value The model to set.
1124      * @return This builder for chaining.
1125      */
setModel(java.lang.String value)1126     public Builder setModel(java.lang.String value) {
1127       if (value == null) {
1128         throw new NullPointerException();
1129       }
1130       model_ = value;
1131       bitField0_ |= 0x00000004;
1132       onChanged();
1133       return this;
1134     }
1135     /**
1136      *
1137      *
1138      * <pre>
1139      * Model to use for the feature.
1140      * Supported values: "builtin/stable" (the default if unset) and
1141      * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
1142      * support "builtin/weekly" for the bleeding edge release updated weekly.
1143      * </pre>
1144      *
1145      * <code>string model = 3;</code>
1146      *
1147      * @return This builder for chaining.
1148      */
clearModel()1149     public Builder clearModel() {
1150       model_ = getDefaultInstance().getModel();
1151       bitField0_ = (bitField0_ & ~0x00000004);
1152       onChanged();
1153       return this;
1154     }
1155     /**
1156      *
1157      *
1158      * <pre>
1159      * Model to use for the feature.
1160      * Supported values: "builtin/stable" (the default if unset) and
1161      * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
1162      * support "builtin/weekly" for the bleeding edge release updated weekly.
1163      * </pre>
1164      *
1165      * <code>string model = 3;</code>
1166      *
1167      * @param value The bytes for model to set.
1168      * @return This builder for chaining.
1169      */
setModelBytes(com.google.protobuf.ByteString value)1170     public Builder setModelBytes(com.google.protobuf.ByteString value) {
1171       if (value == null) {
1172         throw new NullPointerException();
1173       }
1174       checkByteStringIsUtf8(value);
1175       model_ = value;
1176       bitField0_ |= 0x00000004;
1177       onChanged();
1178       return this;
1179     }
1180 
1181     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1182     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
1183       return super.setUnknownFields(unknownFields);
1184     }
1185 
1186     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1187     public final Builder mergeUnknownFields(
1188         final com.google.protobuf.UnknownFieldSet unknownFields) {
1189       return super.mergeUnknownFields(unknownFields);
1190     }
1191 
1192     // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1p2beta1.Feature)
1193   }
1194 
1195   // @@protoc_insertion_point(class_scope:google.cloud.vision.v1p2beta1.Feature)
1196   private static final com.google.cloud.vision.v1p2beta1.Feature DEFAULT_INSTANCE;
1197 
1198   static {
1199     DEFAULT_INSTANCE = new com.google.cloud.vision.v1p2beta1.Feature();
1200   }
1201 
getDefaultInstance()1202   public static com.google.cloud.vision.v1p2beta1.Feature getDefaultInstance() {
1203     return DEFAULT_INSTANCE;
1204   }
1205 
1206   private static final com.google.protobuf.Parser<Feature> PARSER =
1207       new com.google.protobuf.AbstractParser<Feature>() {
1208         @java.lang.Override
1209         public Feature parsePartialFrom(
1210             com.google.protobuf.CodedInputStream input,
1211             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1212             throws com.google.protobuf.InvalidProtocolBufferException {
1213           Builder builder = newBuilder();
1214           try {
1215             builder.mergeFrom(input, extensionRegistry);
1216           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1217             throw e.setUnfinishedMessage(builder.buildPartial());
1218           } catch (com.google.protobuf.UninitializedMessageException e) {
1219             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1220           } catch (java.io.IOException e) {
1221             throw new com.google.protobuf.InvalidProtocolBufferException(e)
1222                 .setUnfinishedMessage(builder.buildPartial());
1223           }
1224           return builder.buildPartial();
1225         }
1226       };
1227 
parser()1228   public static com.google.protobuf.Parser<Feature> parser() {
1229     return PARSER;
1230   }
1231 
1232   @java.lang.Override
getParserForType()1233   public com.google.protobuf.Parser<Feature> getParserForType() {
1234     return PARSER;
1235   }
1236 
1237   @java.lang.Override
getDefaultInstanceForType()1238   public com.google.cloud.vision.v1p2beta1.Feature getDefaultInstanceForType() {
1239     return DEFAULT_INSTANCE;
1240   }
1241 }
1242