001    //
002    // Generated by protoc, do not edit by hand.
003    //
004    package org.apache.activemq.store.kahadb.data;
005    
006    
007    public final class KahaXATransactionId extends KahaXATransactionIdBase<KahaXATransactionId> {
008    
009       public java.util.ArrayList<String> missingFields() {
010          java.util.ArrayList<String> missingFields = super.missingFields();
011          if(  !hasFormatId() ) {
012             missingFields.add("format_id");
013          }
014          if(  !hasBranchQualifier() ) {
015             missingFields.add("branch_qualifier");
016          }
017          if(  !hasGlobalTransactionId() ) {
018             missingFields.add("global_transaction_id");
019          }
020          return missingFields;
021       }
022    
023       public void clear() {
024          super.clear();
025          clearFormatId();
026          clearBranchQualifier();
027          clearGlobalTransactionId();
028       }
029    
030       public KahaXATransactionId clone() {
031          return new KahaXATransactionId().mergeFrom(this);
032       }
033    
034       public KahaXATransactionId mergeFrom(KahaXATransactionId other) {
035          if (other.hasFormatId()) {
036             setFormatId(other.getFormatId());
037          }
038          if (other.hasBranchQualifier()) {
039             setBranchQualifier(other.getBranchQualifier());
040          }
041          if (other.hasGlobalTransactionId()) {
042             setGlobalTransactionId(other.getGlobalTransactionId());
043          }
044          return this;
045       }
046    
047       public int serializedSizeUnframed() {
048          if (memoizedSerializedSize != -1)
049             return memoizedSerializedSize;
050    
051          int size = 0;
052          if (hasFormatId()) {
053             size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(1, getFormatId());
054          }
055          if (hasBranchQualifier()) {
056             size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize(2, getBranchQualifier());
057          }
058          if (hasGlobalTransactionId()) {
059             size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize(3, getGlobalTransactionId());
060          }
061          memoizedSerializedSize = size;
062          return size;
063       }
064    
065       public KahaXATransactionId mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
066          while (true) {
067             int tag = input.readTag();
068             if ((tag & 0x07) == 4) {
069                return this;
070             }
071             switch (tag) {
072             case 0:
073                return this;
074             default: {
075                break;
076             }
077             case 8:
078                setFormatId(input.readInt32());
079                break;
080             case 18:
081                setBranchQualifier(input.readBytes());
082                break;
083             case 26:
084                setGlobalTransactionId(input.readBytes());
085                break;
086             }
087          }
088       }
089       public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
090          if (hasFormatId()) {
091             output.writeInt32(1, getFormatId());
092          }
093          if (hasBranchQualifier()) {
094             output.writeBytes(2, getBranchQualifier());
095          }
096          if (hasGlobalTransactionId()) {
097             output.writeBytes(3, getGlobalTransactionId());
098          }
099       }
100    
101       public static KahaXATransactionId parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
102          return new KahaXATransactionId().mergeUnframed(data).checktInitialized();
103       }
104    
105       public static KahaXATransactionId parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
106          return new KahaXATransactionId().mergeUnframed(data).checktInitialized();
107       }
108    
109       public static KahaXATransactionId parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
110          return new KahaXATransactionId().mergeUnframed(data).checktInitialized();
111       }
112    
113       public static KahaXATransactionId parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
114          return new KahaXATransactionId().mergeUnframed(data).checktInitialized();
115       }
116    
117       public static KahaXATransactionId parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
118          return new KahaXATransactionId().mergeFramed(data).checktInitialized();
119       }
120    
121       public static KahaXATransactionId parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
122          return new KahaXATransactionId().mergeFramed(data).checktInitialized();
123       }
124    
125       public static KahaXATransactionId parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
126          return new KahaXATransactionId().mergeFramed(data).checktInitialized();
127       }
128    
129       public static KahaXATransactionId parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
130          return new KahaXATransactionId().mergeFramed(data).checktInitialized();
131       }
132    
133       public String toString() {
134          return toString(new java.lang.StringBuilder(), "").toString();
135       }
136    
137       public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
138          if(  hasFormatId() ) {
139             sb.append(prefix+"format_id: ");
140             sb.append(getFormatId());
141             sb.append("\n");
142          }
143          if(  hasBranchQualifier() ) {
144             sb.append(prefix+"branch_qualifier: ");
145             sb.append(getBranchQualifier());
146             sb.append("\n");
147          }
148          if(  hasGlobalTransactionId() ) {
149             sb.append(prefix+"global_transaction_id: ");
150             sb.append(getGlobalTransactionId());
151             sb.append("\n");
152          }
153          return sb;
154       }
155    
156       public boolean equals(Object obj) {
157          if( obj==this )
158             return true;
159          
160          if( obj==null || obj.getClass()!=KahaXATransactionId.class )
161             return false;
162          
163          return equals((KahaXATransactionId)obj);
164       }
165       
166       public boolean equals(KahaXATransactionId obj) {
167          if (hasFormatId() ^ obj.hasFormatId() ) 
168             return false;
169          if (hasFormatId() && ( getFormatId()!=obj.getFormatId() ))
170             return false;
171          if (hasBranchQualifier() ^ obj.hasBranchQualifier() ) 
172             return false;
173          if (hasBranchQualifier() && ( !getBranchQualifier().equals(obj.getBranchQualifier()) ))
174             return false;
175          if (hasGlobalTransactionId() ^ obj.hasGlobalTransactionId() ) 
176             return false;
177          if (hasGlobalTransactionId() && ( !getGlobalTransactionId().equals(obj.getGlobalTransactionId()) ))
178             return false;
179          return true;
180       }
181       
182       public int hashCode() {
183          int rc=-2138302623;
184          if (hasFormatId()) {
185             rc ^= ( 538723218^getFormatId() );
186          }
187          if (hasBranchQualifier()) {
188             rc ^= ( 1822873864^getBranchQualifier().hashCode() );
189          }
190          if (hasGlobalTransactionId()) {
191             rc ^= ( -346697322^getGlobalTransactionId().hashCode() );
192          }
193          return rc;
194       }
195       
196    }
197    
198    abstract class KahaXATransactionIdBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
199    
200       // required int32 format_id = 1;
201       private int f_formatId = 0;
202       private boolean b_formatId;
203    
204       public boolean hasFormatId() {
205          return this.b_formatId;
206       }
207    
208       public int getFormatId() {
209          return this.f_formatId;
210       }
211    
212       public T setFormatId(int formatId) {
213          loadAndClear();
214          this.b_formatId = true;
215          this.f_formatId = formatId;
216          return (T)this;
217       }
218    
219       public void clearFormatId() {
220          loadAndClear();
221          this.b_formatId = false;
222          this.f_formatId = 0;
223       }
224    
225       // required bytes branch_qualifier = 2;
226       private org.apache.activemq.protobuf.Buffer f_branchQualifier = null;
227       private boolean b_branchQualifier;
228    
229       public boolean hasBranchQualifier() {
230          return this.b_branchQualifier;
231       }
232    
233       public org.apache.activemq.protobuf.Buffer getBranchQualifier() {
234          return this.f_branchQualifier;
235       }
236    
237       public T setBranchQualifier(org.apache.activemq.protobuf.Buffer branchQualifier) {
238          loadAndClear();
239          this.b_branchQualifier = true;
240          this.f_branchQualifier = branchQualifier;
241          return (T)this;
242       }
243    
244       public void clearBranchQualifier() {
245          loadAndClear();
246          this.b_branchQualifier = false;
247          this.f_branchQualifier = null;
248       }
249    
250       // required bytes global_transaction_id = 3;
251       private org.apache.activemq.protobuf.Buffer f_globalTransactionId = null;
252       private boolean b_globalTransactionId;
253    
254       public boolean hasGlobalTransactionId() {
255          return this.b_globalTransactionId;
256       }
257    
258       public org.apache.activemq.protobuf.Buffer getGlobalTransactionId() {
259          return this.f_globalTransactionId;
260       }
261    
262       public T setGlobalTransactionId(org.apache.activemq.protobuf.Buffer globalTransactionId) {
263          loadAndClear();
264          this.b_globalTransactionId = true;
265          this.f_globalTransactionId = globalTransactionId;
266          return (T)this;
267       }
268    
269       public void clearGlobalTransactionId() {
270          loadAndClear();
271          this.b_globalTransactionId = false;
272          this.f_globalTransactionId = null;
273       }
274    
275    }
276