001//
002// Generated by protoc, do not edit by hand.
003//
004package org.apache.activemq.store.kahadb.data;
005
006
007public final class KahaTransactionInfo extends KahaTransactionInfoBase<KahaTransactionInfo> {
008
009   public java.util.ArrayList<String> missingFields() {
010      java.util.ArrayList<String> missingFields = super.missingFields();
011      if( hasLocalTransactionId() ) {
012         try {
013            getLocalTransactionId().assertInitialized();
014         } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
015            missingFields.addAll(prefix(e.getMissingFields(),"local_transaction_id."));
016         }
017      }
018      if( hasXaTransactionId() ) {
019         try {
020            getXaTransactionId().assertInitialized();
021         } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
022            missingFields.addAll(prefix(e.getMissingFields(),"xa_transaction_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      clearLocalTransactionId();
038      clearXaTransactionId();
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.hasLocalTransactionId()) {
048         if (hasLocalTransactionId()) {
049            getLocalTransactionId().mergeFrom(other.getLocalTransactionId());
050         } else {
051            setLocalTransactionId(other.getLocalTransactionId().clone());
052         }
053      }
054      if (other.hasXaTransactionId()) {
055         if (hasXaTransactionId()) {
056            getXaTransactionId().mergeFrom(other.getXaTransactionId());
057         } else {
058            setXaTransactionId(other.getXaTransactionId().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 (hasLocalTransactionId()) {
077         size += computeMessageSize(1, getLocalTransactionId());
078      }
079      if (hasXaTransactionId()) {
080         size += computeMessageSize(2, getXaTransactionId());
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 (hasLocalTransactionId()) {
103               getLocalTransactionId().mergeFramed(input);
104            } else {
105               setLocalTransactionId(new KahaLocalTransactionId().mergeFramed(input));
106            }
107            break;
108         case 18:
109            if (hasXaTransactionId()) {
110               getXaTransactionId().mergeFramed(input);
111            } else {
112               setXaTransactionId(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 (hasLocalTransactionId()) {
127         writeMessage(output, 1, getLocalTransactionId());
128      }
129      if (hasXaTransactionId()) {
130         writeMessage(output, 2, getXaTransactionId());
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(  hasLocalTransactionId() ) {
175         sb.append(prefix+"local_transaction_id {\n");
176         getLocalTransactionId().toString(sb, prefix+"  ");
177         sb.append(prefix+"}\n");
178      }
179      if(  hasXaTransactionId() ) {
180         sb.append(prefix+"xa_transaction_id {\n");
181         getXaTransactionId().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 (hasLocalTransactionId() ^ obj.hasLocalTransactionId() ) 
204         return false;
205      if (hasLocalTransactionId() && ( !getLocalTransactionId().equals(obj.getLocalTransactionId()) ))
206         return false;
207      if (hasXaTransactionId() ^ obj.hasXaTransactionId() ) 
208         return false;
209      if (hasXaTransactionId() && ( !getXaTransactionId().equals(obj.getXaTransactionId()) ))
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 (hasLocalTransactionId()) {
221         rc ^= ( 812273422^getLocalTransactionId().hashCode() );
222      }
223      if (hasXaTransactionId()) {
224         rc ^= ( -1026770928^getXaTransactionId().hashCode() );
225      }
226      if (hasPreviousEntry()) {
227         rc ^= ( 508350363^getPreviousEntry().hashCode() );
228      }
229      return rc;
230   }
231   
232}
233
234abstract class KahaTransactionInfoBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
235
236   // optional KahaLocalTransactionId local_transaction_id = 1;
237   private KahaLocalTransactionId f_localTransactionId = null;
238
239   public boolean hasLocalTransactionId() {
240      return this.f_localTransactionId!=null;
241   }
242
243   public KahaLocalTransactionId getLocalTransactionId() {
244      if( this.f_localTransactionId == null ) {
245         this.f_localTransactionId = new KahaLocalTransactionId();
246      }
247      return this.f_localTransactionId;
248   }
249
250   public T setLocalTransactionId(KahaLocalTransactionId localTransactionId) {
251      loadAndClear();
252      this.f_localTransactionId = localTransactionId;
253      return (T)this;
254   }
255
256   public void clearLocalTransactionId() {
257      loadAndClear();
258      this.f_localTransactionId = null;
259   }
260
261   // optional KahaXATransactionId xa_transaction_id = 2;
262   private KahaXATransactionId f_xaTransactionId = null;
263
264   public boolean hasXaTransactionId() {
265      return this.f_xaTransactionId!=null;
266   }
267
268   public KahaXATransactionId getXaTransactionId() {
269      if( this.f_xaTransactionId == null ) {
270         this.f_xaTransactionId = new KahaXATransactionId();
271      }
272      return this.f_xaTransactionId;
273   }
274
275   public T setXaTransactionId(KahaXATransactionId xaTransactionId) {
276      loadAndClear();
277      this.f_xaTransactionId = xaTransactionId;
278      return (T)this;
279   }
280
281   public void clearXaTransactionId() {
282      loadAndClear();
283      this.f_xaTransactionId = 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