• 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/retail/v2/user_event.proto
18 
19 package com.google.cloud.retail.v2;
20 
21 /**
22  *
23  *
24  * <pre>
25  * A transaction represents the entire purchase transaction.
26  * </pre>
27  *
28  * Protobuf type {@code google.cloud.retail.v2.PurchaseTransaction}
29  */
30 public final class PurchaseTransaction extends com.google.protobuf.GeneratedMessageV3
31     implements
32     // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PurchaseTransaction)
33     PurchaseTransactionOrBuilder {
34   private static final long serialVersionUID = 0L;
35   // Use PurchaseTransaction.newBuilder() to construct.
PurchaseTransaction(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36   private PurchaseTransaction(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
37     super(builder);
38   }
39 
PurchaseTransaction()40   private PurchaseTransaction() {
41     id_ = "";
42     currencyCode_ = "";
43   }
44 
45   @java.lang.Override
46   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)47   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
48     return new PurchaseTransaction();
49   }
50 
51   @java.lang.Override
getUnknownFields()52   public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
53     return this.unknownFields;
54   }
55 
getDescriptor()56   public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
57     return com.google.cloud.retail.v2.UserEventProto
58         .internal_static_google_cloud_retail_v2_PurchaseTransaction_descriptor;
59   }
60 
61   @java.lang.Override
62   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()63       internalGetFieldAccessorTable() {
64     return com.google.cloud.retail.v2.UserEventProto
65         .internal_static_google_cloud_retail_v2_PurchaseTransaction_fieldAccessorTable
66         .ensureFieldAccessorsInitialized(
67             com.google.cloud.retail.v2.PurchaseTransaction.class,
68             com.google.cloud.retail.v2.PurchaseTransaction.Builder.class);
69   }
70 
71   public static final int ID_FIELD_NUMBER = 1;
72 
73   @SuppressWarnings("serial")
74   private volatile java.lang.Object id_ = "";
75   /**
76    *
77    *
78    * <pre>
79    * The transaction ID with a length limit of 128 characters.
80    * </pre>
81    *
82    * <code>string id = 1;</code>
83    *
84    * @return The id.
85    */
86   @java.lang.Override
getId()87   public java.lang.String getId() {
88     java.lang.Object ref = id_;
89     if (ref instanceof java.lang.String) {
90       return (java.lang.String) ref;
91     } else {
92       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
93       java.lang.String s = bs.toStringUtf8();
94       id_ = s;
95       return s;
96     }
97   }
98   /**
99    *
100    *
101    * <pre>
102    * The transaction ID with a length limit of 128 characters.
103    * </pre>
104    *
105    * <code>string id = 1;</code>
106    *
107    * @return The bytes for id.
108    */
109   @java.lang.Override
getIdBytes()110   public com.google.protobuf.ByteString getIdBytes() {
111     java.lang.Object ref = id_;
112     if (ref instanceof java.lang.String) {
113       com.google.protobuf.ByteString b =
114           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
115       id_ = b;
116       return b;
117     } else {
118       return (com.google.protobuf.ByteString) ref;
119     }
120   }
121 
122   public static final int REVENUE_FIELD_NUMBER = 2;
123   private float revenue_ = 0F;
124   /**
125    *
126    *
127    * <pre>
128    * Required. Total non-zero revenue or grand total associated with the
129    * transaction. This value include shipping, tax, or other adjustments to
130    * total revenue that you want to include as part of your revenue
131    * calculations.
132    * </pre>
133    *
134    * <code>float revenue = 2 [(.google.api.field_behavior) = REQUIRED];</code>
135    *
136    * @return The revenue.
137    */
138   @java.lang.Override
getRevenue()139   public float getRevenue() {
140     return revenue_;
141   }
142 
143   public static final int TAX_FIELD_NUMBER = 3;
144   private float tax_ = 0F;
145   /**
146    *
147    *
148    * <pre>
149    * All the taxes associated with the transaction.
150    * </pre>
151    *
152    * <code>float tax = 3;</code>
153    *
154    * @return The tax.
155    */
156   @java.lang.Override
getTax()157   public float getTax() {
158     return tax_;
159   }
160 
161   public static final int COST_FIELD_NUMBER = 4;
162   private float cost_ = 0F;
163   /**
164    *
165    *
166    * <pre>
167    * All the costs associated with the products. These can be manufacturing
168    * costs, shipping expenses not borne by the end user, or any other costs,
169    * such that:
170    * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
171    * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
172    * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
173    * </pre>
174    *
175    * <code>float cost = 4;</code>
176    *
177    * @return The cost.
178    */
179   @java.lang.Override
getCost()180   public float getCost() {
181     return cost_;
182   }
183 
184   public static final int CURRENCY_CODE_FIELD_NUMBER = 5;
185 
186   @SuppressWarnings("serial")
187   private volatile java.lang.Object currencyCode_ = "";
188   /**
189    *
190    *
191    * <pre>
192    * Required. Currency code. Use three-character ISO-4217 code.
193    * </pre>
194    *
195    * <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
196    *
197    * @return The currencyCode.
198    */
199   @java.lang.Override
getCurrencyCode()200   public java.lang.String getCurrencyCode() {
201     java.lang.Object ref = currencyCode_;
202     if (ref instanceof java.lang.String) {
203       return (java.lang.String) ref;
204     } else {
205       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
206       java.lang.String s = bs.toStringUtf8();
207       currencyCode_ = s;
208       return s;
209     }
210   }
211   /**
212    *
213    *
214    * <pre>
215    * Required. Currency code. Use three-character ISO-4217 code.
216    * </pre>
217    *
218    * <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
219    *
220    * @return The bytes for currencyCode.
221    */
222   @java.lang.Override
getCurrencyCodeBytes()223   public com.google.protobuf.ByteString getCurrencyCodeBytes() {
224     java.lang.Object ref = currencyCode_;
225     if (ref instanceof java.lang.String) {
226       com.google.protobuf.ByteString b =
227           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
228       currencyCode_ = b;
229       return b;
230     } else {
231       return (com.google.protobuf.ByteString) ref;
232     }
233   }
234 
235   private byte memoizedIsInitialized = -1;
236 
237   @java.lang.Override
isInitialized()238   public final boolean isInitialized() {
239     byte isInitialized = memoizedIsInitialized;
240     if (isInitialized == 1) return true;
241     if (isInitialized == 0) return false;
242 
243     memoizedIsInitialized = 1;
244     return true;
245   }
246 
247   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)248   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
249     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
250       com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
251     }
252     if (java.lang.Float.floatToRawIntBits(revenue_) != 0) {
253       output.writeFloat(2, revenue_);
254     }
255     if (java.lang.Float.floatToRawIntBits(tax_) != 0) {
256       output.writeFloat(3, tax_);
257     }
258     if (java.lang.Float.floatToRawIntBits(cost_) != 0) {
259       output.writeFloat(4, cost_);
260     }
261     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(currencyCode_)) {
262       com.google.protobuf.GeneratedMessageV3.writeString(output, 5, currencyCode_);
263     }
264     getUnknownFields().writeTo(output);
265   }
266 
267   @java.lang.Override
getSerializedSize()268   public int getSerializedSize() {
269     int size = memoizedSize;
270     if (size != -1) return size;
271 
272     size = 0;
273     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
274       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
275     }
276     if (java.lang.Float.floatToRawIntBits(revenue_) != 0) {
277       size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, revenue_);
278     }
279     if (java.lang.Float.floatToRawIntBits(tax_) != 0) {
280       size += com.google.protobuf.CodedOutputStream.computeFloatSize(3, tax_);
281     }
282     if (java.lang.Float.floatToRawIntBits(cost_) != 0) {
283       size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, cost_);
284     }
285     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(currencyCode_)) {
286       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, currencyCode_);
287     }
288     size += getUnknownFields().getSerializedSize();
289     memoizedSize = size;
290     return size;
291   }
292 
293   @java.lang.Override
equals(final java.lang.Object obj)294   public boolean equals(final java.lang.Object obj) {
295     if (obj == this) {
296       return true;
297     }
298     if (!(obj instanceof com.google.cloud.retail.v2.PurchaseTransaction)) {
299       return super.equals(obj);
300     }
301     com.google.cloud.retail.v2.PurchaseTransaction other =
302         (com.google.cloud.retail.v2.PurchaseTransaction) obj;
303 
304     if (!getId().equals(other.getId())) return false;
305     if (java.lang.Float.floatToIntBits(getRevenue())
306         != java.lang.Float.floatToIntBits(other.getRevenue())) return false;
307     if (java.lang.Float.floatToIntBits(getTax()) != java.lang.Float.floatToIntBits(other.getTax()))
308       return false;
309     if (java.lang.Float.floatToIntBits(getCost())
310         != java.lang.Float.floatToIntBits(other.getCost())) return false;
311     if (!getCurrencyCode().equals(other.getCurrencyCode())) return false;
312     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
313     return true;
314   }
315 
316   @java.lang.Override
hashCode()317   public int hashCode() {
318     if (memoizedHashCode != 0) {
319       return memoizedHashCode;
320     }
321     int hash = 41;
322     hash = (19 * hash) + getDescriptor().hashCode();
323     hash = (37 * hash) + ID_FIELD_NUMBER;
324     hash = (53 * hash) + getId().hashCode();
325     hash = (37 * hash) + REVENUE_FIELD_NUMBER;
326     hash = (53 * hash) + java.lang.Float.floatToIntBits(getRevenue());
327     hash = (37 * hash) + TAX_FIELD_NUMBER;
328     hash = (53 * hash) + java.lang.Float.floatToIntBits(getTax());
329     hash = (37 * hash) + COST_FIELD_NUMBER;
330     hash = (53 * hash) + java.lang.Float.floatToIntBits(getCost());
331     hash = (37 * hash) + CURRENCY_CODE_FIELD_NUMBER;
332     hash = (53 * hash) + getCurrencyCode().hashCode();
333     hash = (29 * hash) + getUnknownFields().hashCode();
334     memoizedHashCode = hash;
335     return hash;
336   }
337 
parseFrom(java.nio.ByteBuffer data)338   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(java.nio.ByteBuffer data)
339       throws com.google.protobuf.InvalidProtocolBufferException {
340     return PARSER.parseFrom(data);
341   }
342 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)343   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(
344       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
345       throws com.google.protobuf.InvalidProtocolBufferException {
346     return PARSER.parseFrom(data, extensionRegistry);
347   }
348 
parseFrom( com.google.protobuf.ByteString data)349   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(
350       com.google.protobuf.ByteString data)
351       throws com.google.protobuf.InvalidProtocolBufferException {
352     return PARSER.parseFrom(data);
353   }
354 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)355   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(
356       com.google.protobuf.ByteString data,
357       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
358       throws com.google.protobuf.InvalidProtocolBufferException {
359     return PARSER.parseFrom(data, extensionRegistry);
360   }
361 
parseFrom(byte[] data)362   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(byte[] data)
363       throws com.google.protobuf.InvalidProtocolBufferException {
364     return PARSER.parseFrom(data);
365   }
366 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)367   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(
368       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
369       throws com.google.protobuf.InvalidProtocolBufferException {
370     return PARSER.parseFrom(data, extensionRegistry);
371   }
372 
parseFrom(java.io.InputStream input)373   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(java.io.InputStream input)
374       throws java.io.IOException {
375     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
376   }
377 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)378   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(
379       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
380       throws java.io.IOException {
381     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
382         PARSER, input, extensionRegistry);
383   }
384 
parseDelimitedFrom( java.io.InputStream input)385   public static com.google.cloud.retail.v2.PurchaseTransaction parseDelimitedFrom(
386       java.io.InputStream input) throws java.io.IOException {
387     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
388   }
389 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)390   public static com.google.cloud.retail.v2.PurchaseTransaction parseDelimitedFrom(
391       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
392       throws java.io.IOException {
393     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
394         PARSER, input, extensionRegistry);
395   }
396 
parseFrom( com.google.protobuf.CodedInputStream input)397   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(
398       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
399     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
400   }
401 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)402   public static com.google.cloud.retail.v2.PurchaseTransaction parseFrom(
403       com.google.protobuf.CodedInputStream input,
404       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
405       throws java.io.IOException {
406     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
407         PARSER, input, extensionRegistry);
408   }
409 
410   @java.lang.Override
newBuilderForType()411   public Builder newBuilderForType() {
412     return newBuilder();
413   }
414 
newBuilder()415   public static Builder newBuilder() {
416     return DEFAULT_INSTANCE.toBuilder();
417   }
418 
newBuilder(com.google.cloud.retail.v2.PurchaseTransaction prototype)419   public static Builder newBuilder(com.google.cloud.retail.v2.PurchaseTransaction prototype) {
420     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
421   }
422 
423   @java.lang.Override
toBuilder()424   public Builder toBuilder() {
425     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
426   }
427 
428   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)429   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
430     Builder builder = new Builder(parent);
431     return builder;
432   }
433   /**
434    *
435    *
436    * <pre>
437    * A transaction represents the entire purchase transaction.
438    * </pre>
439    *
440    * Protobuf type {@code google.cloud.retail.v2.PurchaseTransaction}
441    */
442   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
443       implements
444       // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PurchaseTransaction)
445       com.google.cloud.retail.v2.PurchaseTransactionOrBuilder {
getDescriptor()446     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
447       return com.google.cloud.retail.v2.UserEventProto
448           .internal_static_google_cloud_retail_v2_PurchaseTransaction_descriptor;
449     }
450 
451     @java.lang.Override
452     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()453         internalGetFieldAccessorTable() {
454       return com.google.cloud.retail.v2.UserEventProto
455           .internal_static_google_cloud_retail_v2_PurchaseTransaction_fieldAccessorTable
456           .ensureFieldAccessorsInitialized(
457               com.google.cloud.retail.v2.PurchaseTransaction.class,
458               com.google.cloud.retail.v2.PurchaseTransaction.Builder.class);
459     }
460 
461     // Construct using com.google.cloud.retail.v2.PurchaseTransaction.newBuilder()
Builder()462     private Builder() {}
463 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)464     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
465       super(parent);
466     }
467 
468     @java.lang.Override
clear()469     public Builder clear() {
470       super.clear();
471       bitField0_ = 0;
472       id_ = "";
473       revenue_ = 0F;
474       tax_ = 0F;
475       cost_ = 0F;
476       currencyCode_ = "";
477       return this;
478     }
479 
480     @java.lang.Override
getDescriptorForType()481     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
482       return com.google.cloud.retail.v2.UserEventProto
483           .internal_static_google_cloud_retail_v2_PurchaseTransaction_descriptor;
484     }
485 
486     @java.lang.Override
getDefaultInstanceForType()487     public com.google.cloud.retail.v2.PurchaseTransaction getDefaultInstanceForType() {
488       return com.google.cloud.retail.v2.PurchaseTransaction.getDefaultInstance();
489     }
490 
491     @java.lang.Override
build()492     public com.google.cloud.retail.v2.PurchaseTransaction build() {
493       com.google.cloud.retail.v2.PurchaseTransaction result = buildPartial();
494       if (!result.isInitialized()) {
495         throw newUninitializedMessageException(result);
496       }
497       return result;
498     }
499 
500     @java.lang.Override
buildPartial()501     public com.google.cloud.retail.v2.PurchaseTransaction buildPartial() {
502       com.google.cloud.retail.v2.PurchaseTransaction result =
503           new com.google.cloud.retail.v2.PurchaseTransaction(this);
504       if (bitField0_ != 0) {
505         buildPartial0(result);
506       }
507       onBuilt();
508       return result;
509     }
510 
buildPartial0(com.google.cloud.retail.v2.PurchaseTransaction result)511     private void buildPartial0(com.google.cloud.retail.v2.PurchaseTransaction result) {
512       int from_bitField0_ = bitField0_;
513       if (((from_bitField0_ & 0x00000001) != 0)) {
514         result.id_ = id_;
515       }
516       if (((from_bitField0_ & 0x00000002) != 0)) {
517         result.revenue_ = revenue_;
518       }
519       if (((from_bitField0_ & 0x00000004) != 0)) {
520         result.tax_ = tax_;
521       }
522       if (((from_bitField0_ & 0x00000008) != 0)) {
523         result.cost_ = cost_;
524       }
525       if (((from_bitField0_ & 0x00000010) != 0)) {
526         result.currencyCode_ = currencyCode_;
527       }
528     }
529 
530     @java.lang.Override
clone()531     public Builder clone() {
532       return super.clone();
533     }
534 
535     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)536     public Builder setField(
537         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
538       return super.setField(field, value);
539     }
540 
541     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)542     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
543       return super.clearField(field);
544     }
545 
546     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)547     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
548       return super.clearOneof(oneof);
549     }
550 
551     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)552     public Builder setRepeatedField(
553         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
554       return super.setRepeatedField(field, index, value);
555     }
556 
557     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)558     public Builder addRepeatedField(
559         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
560       return super.addRepeatedField(field, value);
561     }
562 
563     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)564     public Builder mergeFrom(com.google.protobuf.Message other) {
565       if (other instanceof com.google.cloud.retail.v2.PurchaseTransaction) {
566         return mergeFrom((com.google.cloud.retail.v2.PurchaseTransaction) other);
567       } else {
568         super.mergeFrom(other);
569         return this;
570       }
571     }
572 
mergeFrom(com.google.cloud.retail.v2.PurchaseTransaction other)573     public Builder mergeFrom(com.google.cloud.retail.v2.PurchaseTransaction other) {
574       if (other == com.google.cloud.retail.v2.PurchaseTransaction.getDefaultInstance()) return this;
575       if (!other.getId().isEmpty()) {
576         id_ = other.id_;
577         bitField0_ |= 0x00000001;
578         onChanged();
579       }
580       if (other.getRevenue() != 0F) {
581         setRevenue(other.getRevenue());
582       }
583       if (other.getTax() != 0F) {
584         setTax(other.getTax());
585       }
586       if (other.getCost() != 0F) {
587         setCost(other.getCost());
588       }
589       if (!other.getCurrencyCode().isEmpty()) {
590         currencyCode_ = other.currencyCode_;
591         bitField0_ |= 0x00000010;
592         onChanged();
593       }
594       this.mergeUnknownFields(other.getUnknownFields());
595       onChanged();
596       return this;
597     }
598 
599     @java.lang.Override
isInitialized()600     public final boolean isInitialized() {
601       return true;
602     }
603 
604     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)605     public Builder mergeFrom(
606         com.google.protobuf.CodedInputStream input,
607         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
608         throws java.io.IOException {
609       if (extensionRegistry == null) {
610         throw new java.lang.NullPointerException();
611       }
612       try {
613         boolean done = false;
614         while (!done) {
615           int tag = input.readTag();
616           switch (tag) {
617             case 0:
618               done = true;
619               break;
620             case 10:
621               {
622                 id_ = input.readStringRequireUtf8();
623                 bitField0_ |= 0x00000001;
624                 break;
625               } // case 10
626             case 21:
627               {
628                 revenue_ = input.readFloat();
629                 bitField0_ |= 0x00000002;
630                 break;
631               } // case 21
632             case 29:
633               {
634                 tax_ = input.readFloat();
635                 bitField0_ |= 0x00000004;
636                 break;
637               } // case 29
638             case 37:
639               {
640                 cost_ = input.readFloat();
641                 bitField0_ |= 0x00000008;
642                 break;
643               } // case 37
644             case 42:
645               {
646                 currencyCode_ = input.readStringRequireUtf8();
647                 bitField0_ |= 0x00000010;
648                 break;
649               } // case 42
650             default:
651               {
652                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
653                   done = true; // was an endgroup tag
654                 }
655                 break;
656               } // default:
657           } // switch (tag)
658         } // while (!done)
659       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
660         throw e.unwrapIOException();
661       } finally {
662         onChanged();
663       } // finally
664       return this;
665     }
666 
667     private int bitField0_;
668 
669     private java.lang.Object id_ = "";
670     /**
671      *
672      *
673      * <pre>
674      * The transaction ID with a length limit of 128 characters.
675      * </pre>
676      *
677      * <code>string id = 1;</code>
678      *
679      * @return The id.
680      */
getId()681     public java.lang.String getId() {
682       java.lang.Object ref = id_;
683       if (!(ref instanceof java.lang.String)) {
684         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
685         java.lang.String s = bs.toStringUtf8();
686         id_ = s;
687         return s;
688       } else {
689         return (java.lang.String) ref;
690       }
691     }
692     /**
693      *
694      *
695      * <pre>
696      * The transaction ID with a length limit of 128 characters.
697      * </pre>
698      *
699      * <code>string id = 1;</code>
700      *
701      * @return The bytes for id.
702      */
getIdBytes()703     public com.google.protobuf.ByteString getIdBytes() {
704       java.lang.Object ref = id_;
705       if (ref instanceof String) {
706         com.google.protobuf.ByteString b =
707             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
708         id_ = b;
709         return b;
710       } else {
711         return (com.google.protobuf.ByteString) ref;
712       }
713     }
714     /**
715      *
716      *
717      * <pre>
718      * The transaction ID with a length limit of 128 characters.
719      * </pre>
720      *
721      * <code>string id = 1;</code>
722      *
723      * @param value The id to set.
724      * @return This builder for chaining.
725      */
setId(java.lang.String value)726     public Builder setId(java.lang.String value) {
727       if (value == null) {
728         throw new NullPointerException();
729       }
730       id_ = value;
731       bitField0_ |= 0x00000001;
732       onChanged();
733       return this;
734     }
735     /**
736      *
737      *
738      * <pre>
739      * The transaction ID with a length limit of 128 characters.
740      * </pre>
741      *
742      * <code>string id = 1;</code>
743      *
744      * @return This builder for chaining.
745      */
clearId()746     public Builder clearId() {
747       id_ = getDefaultInstance().getId();
748       bitField0_ = (bitField0_ & ~0x00000001);
749       onChanged();
750       return this;
751     }
752     /**
753      *
754      *
755      * <pre>
756      * The transaction ID with a length limit of 128 characters.
757      * </pre>
758      *
759      * <code>string id = 1;</code>
760      *
761      * @param value The bytes for id to set.
762      * @return This builder for chaining.
763      */
setIdBytes(com.google.protobuf.ByteString value)764     public Builder setIdBytes(com.google.protobuf.ByteString value) {
765       if (value == null) {
766         throw new NullPointerException();
767       }
768       checkByteStringIsUtf8(value);
769       id_ = value;
770       bitField0_ |= 0x00000001;
771       onChanged();
772       return this;
773     }
774 
775     private float revenue_;
776     /**
777      *
778      *
779      * <pre>
780      * Required. Total non-zero revenue or grand total associated with the
781      * transaction. This value include shipping, tax, or other adjustments to
782      * total revenue that you want to include as part of your revenue
783      * calculations.
784      * </pre>
785      *
786      * <code>float revenue = 2 [(.google.api.field_behavior) = REQUIRED];</code>
787      *
788      * @return The revenue.
789      */
790     @java.lang.Override
getRevenue()791     public float getRevenue() {
792       return revenue_;
793     }
794     /**
795      *
796      *
797      * <pre>
798      * Required. Total non-zero revenue or grand total associated with the
799      * transaction. This value include shipping, tax, or other adjustments to
800      * total revenue that you want to include as part of your revenue
801      * calculations.
802      * </pre>
803      *
804      * <code>float revenue = 2 [(.google.api.field_behavior) = REQUIRED];</code>
805      *
806      * @param value The revenue to set.
807      * @return This builder for chaining.
808      */
setRevenue(float value)809     public Builder setRevenue(float value) {
810 
811       revenue_ = value;
812       bitField0_ |= 0x00000002;
813       onChanged();
814       return this;
815     }
816     /**
817      *
818      *
819      * <pre>
820      * Required. Total non-zero revenue or grand total associated with the
821      * transaction. This value include shipping, tax, or other adjustments to
822      * total revenue that you want to include as part of your revenue
823      * calculations.
824      * </pre>
825      *
826      * <code>float revenue = 2 [(.google.api.field_behavior) = REQUIRED];</code>
827      *
828      * @return This builder for chaining.
829      */
clearRevenue()830     public Builder clearRevenue() {
831       bitField0_ = (bitField0_ & ~0x00000002);
832       revenue_ = 0F;
833       onChanged();
834       return this;
835     }
836 
837     private float tax_;
838     /**
839      *
840      *
841      * <pre>
842      * All the taxes associated with the transaction.
843      * </pre>
844      *
845      * <code>float tax = 3;</code>
846      *
847      * @return The tax.
848      */
849     @java.lang.Override
getTax()850     public float getTax() {
851       return tax_;
852     }
853     /**
854      *
855      *
856      * <pre>
857      * All the taxes associated with the transaction.
858      * </pre>
859      *
860      * <code>float tax = 3;</code>
861      *
862      * @param value The tax to set.
863      * @return This builder for chaining.
864      */
setTax(float value)865     public Builder setTax(float value) {
866 
867       tax_ = value;
868       bitField0_ |= 0x00000004;
869       onChanged();
870       return this;
871     }
872     /**
873      *
874      *
875      * <pre>
876      * All the taxes associated with the transaction.
877      * </pre>
878      *
879      * <code>float tax = 3;</code>
880      *
881      * @return This builder for chaining.
882      */
clearTax()883     public Builder clearTax() {
884       bitField0_ = (bitField0_ & ~0x00000004);
885       tax_ = 0F;
886       onChanged();
887       return this;
888     }
889 
890     private float cost_;
891     /**
892      *
893      *
894      * <pre>
895      * All the costs associated with the products. These can be manufacturing
896      * costs, shipping expenses not borne by the end user, or any other costs,
897      * such that:
898      * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
899      * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
900      * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
901      * </pre>
902      *
903      * <code>float cost = 4;</code>
904      *
905      * @return The cost.
906      */
907     @java.lang.Override
getCost()908     public float getCost() {
909       return cost_;
910     }
911     /**
912      *
913      *
914      * <pre>
915      * All the costs associated with the products. These can be manufacturing
916      * costs, shipping expenses not borne by the end user, or any other costs,
917      * such that:
918      * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
919      * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
920      * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
921      * </pre>
922      *
923      * <code>float cost = 4;</code>
924      *
925      * @param value The cost to set.
926      * @return This builder for chaining.
927      */
setCost(float value)928     public Builder setCost(float value) {
929 
930       cost_ = value;
931       bitField0_ |= 0x00000008;
932       onChanged();
933       return this;
934     }
935     /**
936      *
937      *
938      * <pre>
939      * All the costs associated with the products. These can be manufacturing
940      * costs, shipping expenses not borne by the end user, or any other costs,
941      * such that:
942      * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
943      * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
944      * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
945      * </pre>
946      *
947      * <code>float cost = 4;</code>
948      *
949      * @return This builder for chaining.
950      */
clearCost()951     public Builder clearCost() {
952       bitField0_ = (bitField0_ & ~0x00000008);
953       cost_ = 0F;
954       onChanged();
955       return this;
956     }
957 
958     private java.lang.Object currencyCode_ = "";
959     /**
960      *
961      *
962      * <pre>
963      * Required. Currency code. Use three-character ISO-4217 code.
964      * </pre>
965      *
966      * <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
967      *
968      * @return The currencyCode.
969      */
getCurrencyCode()970     public java.lang.String getCurrencyCode() {
971       java.lang.Object ref = currencyCode_;
972       if (!(ref instanceof java.lang.String)) {
973         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
974         java.lang.String s = bs.toStringUtf8();
975         currencyCode_ = s;
976         return s;
977       } else {
978         return (java.lang.String) ref;
979       }
980     }
981     /**
982      *
983      *
984      * <pre>
985      * Required. Currency code. Use three-character ISO-4217 code.
986      * </pre>
987      *
988      * <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
989      *
990      * @return The bytes for currencyCode.
991      */
getCurrencyCodeBytes()992     public com.google.protobuf.ByteString getCurrencyCodeBytes() {
993       java.lang.Object ref = currencyCode_;
994       if (ref instanceof String) {
995         com.google.protobuf.ByteString b =
996             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
997         currencyCode_ = b;
998         return b;
999       } else {
1000         return (com.google.protobuf.ByteString) ref;
1001       }
1002     }
1003     /**
1004      *
1005      *
1006      * <pre>
1007      * Required. Currency code. Use three-character ISO-4217 code.
1008      * </pre>
1009      *
1010      * <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
1011      *
1012      * @param value The currencyCode to set.
1013      * @return This builder for chaining.
1014      */
setCurrencyCode(java.lang.String value)1015     public Builder setCurrencyCode(java.lang.String value) {
1016       if (value == null) {
1017         throw new NullPointerException();
1018       }
1019       currencyCode_ = value;
1020       bitField0_ |= 0x00000010;
1021       onChanged();
1022       return this;
1023     }
1024     /**
1025      *
1026      *
1027      * <pre>
1028      * Required. Currency code. Use three-character ISO-4217 code.
1029      * </pre>
1030      *
1031      * <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
1032      *
1033      * @return This builder for chaining.
1034      */
clearCurrencyCode()1035     public Builder clearCurrencyCode() {
1036       currencyCode_ = getDefaultInstance().getCurrencyCode();
1037       bitField0_ = (bitField0_ & ~0x00000010);
1038       onChanged();
1039       return this;
1040     }
1041     /**
1042      *
1043      *
1044      * <pre>
1045      * Required. Currency code. Use three-character ISO-4217 code.
1046      * </pre>
1047      *
1048      * <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
1049      *
1050      * @param value The bytes for currencyCode to set.
1051      * @return This builder for chaining.
1052      */
setCurrencyCodeBytes(com.google.protobuf.ByteString value)1053     public Builder setCurrencyCodeBytes(com.google.protobuf.ByteString value) {
1054       if (value == null) {
1055         throw new NullPointerException();
1056       }
1057       checkByteStringIsUtf8(value);
1058       currencyCode_ = value;
1059       bitField0_ |= 0x00000010;
1060       onChanged();
1061       return this;
1062     }
1063 
1064     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1065     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
1066       return super.setUnknownFields(unknownFields);
1067     }
1068 
1069     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1070     public final Builder mergeUnknownFields(
1071         final com.google.protobuf.UnknownFieldSet unknownFields) {
1072       return super.mergeUnknownFields(unknownFields);
1073     }
1074 
1075     // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PurchaseTransaction)
1076   }
1077 
1078   // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PurchaseTransaction)
1079   private static final com.google.cloud.retail.v2.PurchaseTransaction DEFAULT_INSTANCE;
1080 
1081   static {
1082     DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PurchaseTransaction();
1083   }
1084 
getDefaultInstance()1085   public static com.google.cloud.retail.v2.PurchaseTransaction getDefaultInstance() {
1086     return DEFAULT_INSTANCE;
1087   }
1088 
1089   private static final com.google.protobuf.Parser<PurchaseTransaction> PARSER =
1090       new com.google.protobuf.AbstractParser<PurchaseTransaction>() {
1091         @java.lang.Override
1092         public PurchaseTransaction parsePartialFrom(
1093             com.google.protobuf.CodedInputStream input,
1094             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1095             throws com.google.protobuf.InvalidProtocolBufferException {
1096           Builder builder = newBuilder();
1097           try {
1098             builder.mergeFrom(input, extensionRegistry);
1099           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1100             throw e.setUnfinishedMessage(builder.buildPartial());
1101           } catch (com.google.protobuf.UninitializedMessageException e) {
1102             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1103           } catch (java.io.IOException e) {
1104             throw new com.google.protobuf.InvalidProtocolBufferException(e)
1105                 .setUnfinishedMessage(builder.buildPartial());
1106           }
1107           return builder.buildPartial();
1108         }
1109       };
1110 
parser()1111   public static com.google.protobuf.Parser<PurchaseTransaction> parser() {
1112     return PARSER;
1113   }
1114 
1115   @java.lang.Override
getParserForType()1116   public com.google.protobuf.Parser<PurchaseTransaction> getParserForType() {
1117     return PARSER;
1118   }
1119 
1120   @java.lang.Override
getDefaultInstanceForType()1121   public com.google.cloud.retail.v2.PurchaseTransaction getDefaultInstanceForType() {
1122     return DEFAULT_INSTANCE;
1123   }
1124 }
1125