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 KahaTransactionInfo extends KahaTransactionInfoBase<KahaTransactionInfo> {
008    
009       public java.util.ArrayList<String> missingFields() {
010          java.util.ArrayList<String> missingFields = super.missingFields();
011          if( hasLocalTransacitonId() ) {
012             try {
013                getLocalTransacitonId().assertInitialized();
014             } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
015                missingFields.addAll(prefix(e.getMissingFields(),"local_transaciton_id."));
016             }
017          }
018          if( hasXaTransacitonId() ) {
019             try {
020                getXaTransacitonId().assertInitialized();
021             } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
022                missingFields.addAll(prefix(e.getMissingFields(),"xa_transaciton_id."));
023             }
024          }
025          if( hasPreviousEntry() ) {
026             try {
027                getPreviousEntry().assertInitialized();
028             } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
029                missingFields.addAll(prefix(e.getMissingFields(),"previous_entry."));
030             }
031          }
032          return missingFields;
033       }
034    
035       public void clear() {
036          super.clear();
037          clearLocalTransacitonId();
038          clearXaTransacitonId();
039          clearPreviousEntry();
040       }
041    
042       public KahaTransactionInfo clone() {
043          return new KahaTransactionInfo().mergeFrom(this);
044       }
045    
046       public KahaTransactionInfo mergeFrom(KahaTransactionInfo other) {
047          if (other.hasLocalTransacitonId()) {
048             if (hasLocalTransacitonId()) {
049                getLocalTransacitonId().mergeFrom(other.getLocalTransacitonId());
050             } else {
051                setLocalTransacitonId(other.getLocalTransacitonId().clone());
052             }
053          }
054          if (other.hasXaTransacitonId()) {
055             if (hasXaTransacitonId()) {
056                getXaTransacitonId().mergeFrom(other.getXaTransacitonId());
057             } else {
058                setXaTransacitonId(other.getXaTransacitonId().clone());
059             }
060          }
061          if (other.hasPreviousEntry()) {
062             if (hasPreviousEntry()) {
063                getPreviousEntry().mergeFrom(other.getPreviousEntry());
064             } else {
065                setPreviousEntry(other.getPreviousEntry().clone());
066             }
067          }
068          return this;
069       }
070    
071       public int serializedSizeUnframed() {
072          if (memoizedSerializedSize != -1)
073             return memoizedSerializedSize;
074    
075          int size = 0;
076          if (hasLocalTransacitonId()) {
077             size += computeMessageSize(1, getLocalTransacitonId());
078          }
079          if (hasXaTransacitonId()) {
080             size += computeMessageSize(2, getXaTransacitonId());
081          }
082          if (hasPreviousEntry()) {
083             size += computeMessageSize(3, getPreviousEntry());
084          }
085          memoizedSerializedSize = size;
086          return size;
087       }
088    
089       public KahaTransactionInfo mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
090          while (true) {
091             int tag = input.readTag();
092             if ((tag & 0x07) == 4) {
093                return this;
094             }
095             switch (tag) {
096             case 0:
097                return this;
098             default: {
099                break;
100             }
101             case 10:
102                if (hasLocalTransacitonId()) {
103                   getLocalTransacitonId().mergeFramed(input);
104                } else {
105                   setLocalTransacitonId(new KahaLocalTransactionId().mergeFramed(input));
106                }
107                break;
108             case 18:
109                if (hasXaTransacitonId()) {
110                   getXaTransacitonId().mergeFramed(input);
111                } else {
112                   setXaTransacitonId(new KahaXATransactionId().mergeFramed(input));
113                }
114                break;
115             case 26:
116                if (hasPreviousEntry()) {
117                   getPreviousEntry().mergeFramed(input);
118                } else {
119                   setPreviousEntry(new KahaLocation().mergeFramed(input));
120                }
121                break;
122             }
123          }
124       }
125       public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
126          if (hasLocalTransacitonId()) {
127             writeMessage(output, 1, getLocalTransacitonId());
128          }
129          if (hasXaTransacitonId()) {
130             writeMessage(output, 2, getXaTransacitonId());
131          }
132          if (hasPreviousEntry()) {
133             writeMessage(output, 3, getPreviousEntry());
134          }
135       }
136    
137       public static KahaTransactionInfo parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
138          return new KahaTransactionInfo().mergeUnframed(data).checktInitialized();
139       }
140    
141       public static KahaTransactionInfo parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
142          return new KahaTransactionInfo().mergeUnframed(data).checktInitialized();
143       }
144    
145       public static KahaTransactionInfo parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
146          return new KahaTransactionInfo().mergeUnframed(data).checktInitialized();
147       }
148    
149       public static KahaTransactionInfo parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
150          return new KahaTransactionInfo().mergeUnframed(data).checktInitialized();
151       }
152    
153       public static KahaTransactionInfo parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
154          return new KahaTransactionInfo().mergeFramed(data).checktInitialized();
155       }
156    
157       public static KahaTransactionInfo parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
158          return new KahaTransactionInfo().mergeFramed(data).checktInitialized();
159       }
160    
161       public static KahaTransactionInfo parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
162          return new KahaTransactionInfo().mergeFramed(data).checktInitialized();
163       }
164    
165       public static KahaTransactionInfo parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
166          return new KahaTransactionInfo().mergeFramed(data).checktInitialized();
167       }
168    
169       public String toString() {
170          return toString(new java.lang.StringBuilder(), "").toString();
171       }
172    
173       public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
174          if(  hasLocalTransacitonId() ) {
175             sb.append(prefix+"local_transaciton_id {\n");
176             getLocalTransacitonId().toString(sb, prefix+"  ");
177             sb.append(prefix+"}\n");
178          }
179          if(  hasXaTransacitonId() ) {
180             sb.append(prefix+"xa_transaciton_id {\n");
181             getXaTransacitonId().toString(sb, prefix+"  ");
182             sb.append(prefix+"}\n");
183          }
184          if(  hasPreviousEntry() ) {
185             sb.append(prefix+"previous_entry {\n");
186             getPreviousEntry().toString(sb, prefix+"  ");
187             sb.append(prefix+"}\n");
188          }
189          return sb;
190       }
191    
192       public boolean equals(Object obj) {
193          if( obj==this )
194             return true;
195          
196          if( obj==null || obj.getClass()!=KahaTransactionInfo.class )
197             return false;
198          
199          return equals((KahaTransactionInfo)obj);
200       }
201       
202       public boolean equals(KahaTransactionInfo obj) {
203          if (hasLocalTransacitonId() ^ obj.hasLocalTransacitonId() ) 
204             return false;
205          if (hasLocalTransacitonId() && ( !getLocalTransacitonId().equals(obj.getLocalTransacitonId()) ))
206             return false;
207          if (hasXaTransacitonId() ^ obj.hasXaTransacitonId() ) 
208             return false;
209          if (hasXaTransacitonId() && ( !getXaTransacitonId().equals(obj.getXaTransacitonId()) ))
210             return false;
211          if (hasPreviousEntry() ^ obj.hasPreviousEntry() ) 
212             return false;
213          if (hasPreviousEntry() && ( !getPreviousEntry().equals(obj.getPreviousEntry()) ))
214             return false;
215          return true;
216       }
217       
218       public int hashCode() {
219          int rc=156129213;
220          if (hasLocalTransacitonId()) {
221             rc ^= ( 507511492^getLocalTransacitonId().hashCode() );
222          }
223          if (hasXaTransacitonId()) {
224             rc ^= ( -1331532858^getXaTransacitonId().hashCode() );
225          }
226          if (hasPreviousEntry()) {
227             rc ^= ( 508350363^getPreviousEntry().hashCode() );
228          }
229          return rc;
230       }
231       
232    }
233    
234    abstract class KahaTransactionInfoBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
235    
236       // optional KahaLocalTransactionId local_transaciton_id = 1;
237       private KahaLocalTransactionId f_localTransacitonId = null;
238    
239       public boolean hasLocalTransacitonId() {
240          return this.f_localTransacitonId!=null;
241       }
242    
243       public KahaLocalTransactionId getLocalTransacitonId() {
244          if( this.f_localTransacitonId == null ) {
245             this.f_localTransacitonId = new KahaLocalTransactionId();
246          }
247          return this.f_localTransacitonId;
248       }
249    
250       public T setLocalTransacitonId(KahaLocalTransactionId localTransacitonId) {
251          loadAndClear();
252          this.f_localTransacitonId = localTransacitonId;
253          return (T)this;
254       }
255    
256       public void clearLocalTransacitonId() {
257          loadAndClear();
258          this.f_localTransacitonId = null;
259       }
260    
261       // optional KahaXATransactionId xa_transaciton_id = 2;
262       private KahaXATransactionId f_xaTransacitonId = null;
263    
264       public boolean hasXaTransacitonId() {
265          return this.f_xaTransacitonId!=null;
266       }
267    
268       public KahaXATransactionId getXaTransacitonId() {
269          if( this.f_xaTransacitonId == null ) {
270             this.f_xaTransacitonId = new KahaXATransactionId();
271          }
272          return this.f_xaTransacitonId;
273       }
274    
275       public T setXaTransacitonId(KahaXATransactionId xaTransacitonId) {
276          loadAndClear();
277          this.f_xaTransacitonId = xaTransacitonId;
278          return (T)this;
279       }
280    
281       public void clearXaTransacitonId() {
282          loadAndClear();
283          this.f_xaTransacitonId = null;
284       }
285    
286       // optional KahaLocation previous_entry = 3;
287       private KahaLocation f_previousEntry = null;
288    
289       public boolean hasPreviousEntry() {
290          return this.f_previousEntry!=null;
291       }
292    
293       public KahaLocation getPreviousEntry() {
294          if( this.f_previousEntry == null ) {
295             this.f_previousEntry = new KahaLocation();
296          }
297          return this.f_previousEntry;
298       }
299    
300       public T setPreviousEntry(KahaLocation previousEntry) {
301          loadAndClear();
302          this.f_previousEntry = previousEntry;
303          return (T)this;
304       }
305    
306       public void clearPreviousEntry() {
307          loadAndClear();
308          this.f_previousEntry = null;
309       }
310    
311    }
312