001//
002// Generated by protoc, do not edit by hand.
003//
004package org.apache.activemq.store.kahadb.data;
005
006
007public final class KahaRemoveMessageCommand extends KahaRemoveMessageCommandBase<KahaRemoveMessageCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaRemoveMessageCommand> {
008
009   public java.util.ArrayList<String> missingFields() {
010      java.util.ArrayList<String> missingFields = super.missingFields();
011      if(  !hasDestination() ) {
012         missingFields.add("destination");
013      }
014      if(  !hasMessageId() ) {
015         missingFields.add("messageId");
016      }
017      if( hasTransactionInfo() ) {
018         try {
019            getTransactionInfo().assertInitialized();
020         } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
021            missingFields.addAll(prefix(e.getMissingFields(),"transaction_info."));
022         }
023      }
024      if( hasDestination() ) {
025         try {
026            getDestination().assertInitialized();
027         } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
028            missingFields.addAll(prefix(e.getMissingFields(),"destination."));
029         }
030      }
031      return missingFields;
032   }
033
034   public void clear() {
035      super.clear();
036      clearTransactionInfo();
037      clearDestination();
038      clearMessageId();
039      clearAck();
040      clearSubscriptionKey();
041   }
042
043   public KahaRemoveMessageCommand clone() {
044      return new KahaRemoveMessageCommand().mergeFrom(this);
045   }
046
047   public KahaRemoveMessageCommand mergeFrom(KahaRemoveMessageCommand other) {
048      if (other.hasTransactionInfo()) {
049         if (hasTransactionInfo()) {
050            getTransactionInfo().mergeFrom(other.getTransactionInfo());
051         } else {
052            setTransactionInfo(other.getTransactionInfo().clone());
053         }
054      }
055      if (other.hasDestination()) {
056         if (hasDestination()) {
057            getDestination().mergeFrom(other.getDestination());
058         } else {
059            setDestination(other.getDestination().clone());
060         }
061      }
062      if (other.hasMessageId()) {
063         setMessageId(other.getMessageId());
064      }
065      if (other.hasAck()) {
066         setAck(other.getAck());
067      }
068      if (other.hasSubscriptionKey()) {
069         setSubscriptionKey(other.getSubscriptionKey());
070      }
071      return this;
072   }
073
074   public int serializedSizeUnframed() {
075      if (memoizedSerializedSize != -1)
076         return memoizedSerializedSize;
077
078      int size = 0;
079      if (hasTransactionInfo()) {
080         size += computeMessageSize(1, getTransactionInfo());
081      }
082      if (hasDestination()) {
083         size += computeMessageSize(2, getDestination());
084      }
085      if (hasMessageId()) {
086         size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize(3, getMessageId());
087      }
088      if (hasAck()) {
089         size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize(4, getAck());
090      }
091      if (hasSubscriptionKey()) {
092         size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize(5, getSubscriptionKey());
093      }
094      memoizedSerializedSize = size;
095      return size;
096   }
097
098   public KahaRemoveMessageCommand mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
099      while (true) {
100         int tag = input.readTag();
101         if ((tag & 0x07) == 4) {
102            return this;
103         }
104         switch (tag) {
105         case 0:
106            return this;
107         default: {
108            break;
109         }
110         case 10:
111            if (hasTransactionInfo()) {
112               getTransactionInfo().mergeFramed(input);
113            } else {
114               setTransactionInfo(new KahaTransactionInfo().mergeFramed(input));
115            }
116            break;
117         case 18:
118            if (hasDestination()) {
119               getDestination().mergeFramed(input);
120            } else {
121               setDestination(new KahaDestination().mergeFramed(input));
122            }
123            break;
124         case 26:
125            setMessageId(input.readString());
126            break;
127         case 34:
128            setAck(input.readBytes());
129            break;
130         case 42:
131            setSubscriptionKey(input.readString());
132            break;
133         }
134      }
135   }
136   public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
137      if (hasTransactionInfo()) {
138         writeMessage(output, 1, getTransactionInfo());
139      }
140      if (hasDestination()) {
141         writeMessage(output, 2, getDestination());
142      }
143      if (hasMessageId()) {
144         output.writeString(3, getMessageId());
145      }
146      if (hasAck()) {
147         output.writeBytes(4, getAck());
148      }
149      if (hasSubscriptionKey()) {
150         output.writeString(5, getSubscriptionKey());
151      }
152   }
153
154   public static KahaRemoveMessageCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
155      return new KahaRemoveMessageCommand().mergeUnframed(data).checktInitialized();
156   }
157
158   public static KahaRemoveMessageCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
159      return new KahaRemoveMessageCommand().mergeUnframed(data).checktInitialized();
160   }
161
162   public static KahaRemoveMessageCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
163      return new KahaRemoveMessageCommand().mergeUnframed(data).checktInitialized();
164   }
165
166   public static KahaRemoveMessageCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
167      return new KahaRemoveMessageCommand().mergeUnframed(data).checktInitialized();
168   }
169
170   public static KahaRemoveMessageCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
171      return new KahaRemoveMessageCommand().mergeFramed(data).checktInitialized();
172   }
173
174   public static KahaRemoveMessageCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
175      return new KahaRemoveMessageCommand().mergeFramed(data).checktInitialized();
176   }
177
178   public static KahaRemoveMessageCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
179      return new KahaRemoveMessageCommand().mergeFramed(data).checktInitialized();
180   }
181
182   public static KahaRemoveMessageCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
183      return new KahaRemoveMessageCommand().mergeFramed(data).checktInitialized();
184   }
185
186   public String toString() {
187      return toString(new java.lang.StringBuilder(), "").toString();
188   }
189
190   public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
191      if(  hasTransactionInfo() ) {
192         sb.append(prefix+"transaction_info {\n");
193         getTransactionInfo().toString(sb, prefix+"  ");
194         sb.append(prefix+"}\n");
195      }
196      if(  hasDestination() ) {
197         sb.append(prefix+"destination {\n");
198         getDestination().toString(sb, prefix+"  ");
199         sb.append(prefix+"}\n");
200      }
201      if(  hasMessageId() ) {
202         sb.append(prefix+"messageId: ");
203         sb.append(getMessageId());
204         sb.append("\n");
205      }
206      if(  hasAck() ) {
207         sb.append(prefix+"ack: ");
208         sb.append(getAck());
209         sb.append("\n");
210      }
211      if(  hasSubscriptionKey() ) {
212         sb.append(prefix+"subscriptionKey: ");
213         sb.append(getSubscriptionKey());
214         sb.append("\n");
215      }
216      return sb;
217   }
218
219   public void visit(org.apache.activemq.store.kahadb.Visitor visitor) throws java.io.IOException {
220      visitor.visit(this);
221   }
222
223   public KahaEntryType type() {
224      return KahaEntryType.KAHA_REMOVE_MESSAGE_COMMAND;
225   }
226
227   public boolean equals(Object obj) {
228      if( obj==this )
229         return true;
230      
231      if( obj==null || obj.getClass()!=KahaRemoveMessageCommand.class )
232         return false;
233      
234      return equals((KahaRemoveMessageCommand)obj);
235   }
236   
237   public boolean equals(KahaRemoveMessageCommand obj) {
238      if (hasTransactionInfo() ^ obj.hasTransactionInfo() ) 
239         return false;
240      if (hasTransactionInfo() && ( !getTransactionInfo().equals(obj.getTransactionInfo()) ))
241         return false;
242      if (hasDestination() ^ obj.hasDestination() ) 
243         return false;
244      if (hasDestination() && ( !getDestination().equals(obj.getDestination()) ))
245         return false;
246      if (hasMessageId() ^ obj.hasMessageId() ) 
247         return false;
248      if (hasMessageId() && ( !getMessageId().equals(obj.getMessageId()) ))
249         return false;
250      if (hasAck() ^ obj.hasAck() ) 
251         return false;
252      if (hasAck() && ( !getAck().equals(obj.getAck()) ))
253         return false;
254      if (hasSubscriptionKey() ^ obj.hasSubscriptionKey() ) 
255         return false;
256      if (hasSubscriptionKey() && ( !getSubscriptionKey().equals(obj.getSubscriptionKey()) ))
257         return false;
258      return true;
259   }
260   
261   public int hashCode() {
262      int rc=-64211337;
263      if (hasTransactionInfo()) {
264         rc ^= ( 265667724^getTransactionInfo().hashCode() );
265      }
266      if (hasDestination()) {
267         rc ^= ( 238021614^getDestination().hashCode() );
268      }
269      if (hasMessageId()) {
270         rc ^= ( 563954530^getMessageId().hashCode() );
271      }
272      if (hasAck()) {
273         rc ^= ( 65641^getAck().hashCode() );
274      }
275      if (hasSubscriptionKey()) {
276         rc ^= ( 1895830498^getSubscriptionKey().hashCode() );
277      }
278      return rc;
279   }
280   
281}
282
283abstract class KahaRemoveMessageCommandBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
284
285   // optional KahaTransactionInfo transaction_info = 1;
286   private KahaTransactionInfo f_transactionInfo = null;
287
288   public boolean hasTransactionInfo() {
289      return this.f_transactionInfo!=null;
290   }
291
292   public KahaTransactionInfo getTransactionInfo() {
293      if( this.f_transactionInfo == null ) {
294         this.f_transactionInfo = new KahaTransactionInfo();
295      }
296      return this.f_transactionInfo;
297   }
298
299   public T setTransactionInfo(KahaTransactionInfo transactionInfo) {
300      loadAndClear();
301      this.f_transactionInfo = transactionInfo;
302      return (T)this;
303   }
304
305   public void clearTransactionInfo() {
306      loadAndClear();
307      this.f_transactionInfo = null;
308   }
309
310   // required KahaDestination destination = 2;
311   private KahaDestination f_destination = null;
312
313   public boolean hasDestination() {
314      return this.f_destination!=null;
315   }
316
317   public KahaDestination getDestination() {
318      if( this.f_destination == null ) {
319         this.f_destination = new KahaDestination();
320      }
321      return this.f_destination;
322   }
323
324   public T setDestination(KahaDestination destination) {
325      loadAndClear();
326      this.f_destination = destination;
327      return (T)this;
328   }
329
330   public void clearDestination() {
331      loadAndClear();
332      this.f_destination = null;
333   }
334
335   // required string messageId = 3;
336   private java.lang.String f_messageId = null;
337   private boolean b_messageId;
338
339   public boolean hasMessageId() {
340      return this.b_messageId;
341   }
342
343   public java.lang.String getMessageId() {
344      return this.f_messageId;
345   }
346
347   public T setMessageId(java.lang.String messageId) {
348      loadAndClear();
349      this.b_messageId = true;
350      this.f_messageId = messageId;
351      return (T)this;
352   }
353
354   public void clearMessageId() {
355      loadAndClear();
356      this.b_messageId = false;
357      this.f_messageId = null;
358   }
359
360   // optional bytes ack = 4;
361   private org.apache.activemq.protobuf.Buffer f_ack = null;
362   private boolean b_ack;
363
364   public boolean hasAck() {
365      return this.b_ack;
366   }
367
368   public org.apache.activemq.protobuf.Buffer getAck() {
369      return this.f_ack;
370   }
371
372   public T setAck(org.apache.activemq.protobuf.Buffer ack) {
373      loadAndClear();
374      this.b_ack = true;
375      this.f_ack = ack;
376      return (T)this;
377   }
378
379   public void clearAck() {
380      loadAndClear();
381      this.b_ack = false;
382      this.f_ack = null;
383   }
384
385   // optional string subscriptionKey = 5;
386   private java.lang.String f_subscriptionKey = null;
387   private boolean b_subscriptionKey;
388
389   public boolean hasSubscriptionKey() {
390      return this.b_subscriptionKey;
391   }
392
393   public java.lang.String getSubscriptionKey() {
394      return this.f_subscriptionKey;
395   }
396
397   public T setSubscriptionKey(java.lang.String subscriptionKey) {
398      loadAndClear();
399      this.b_subscriptionKey = true;
400      this.f_subscriptionKey = subscriptionKey;
401      return (T)this;
402   }
403
404   public void clearSubscriptionKey() {
405      loadAndClear();
406      this.b_subscriptionKey = false;
407      this.f_subscriptionKey = null;
408   }
409
410}
411