001//
002// Generated by protoc, do not edit by hand.
003//
004package org.apache.activemq.store.kahadb.data;
005
006
007public final class KahaSubscriptionCommand extends KahaSubscriptionCommandBase<KahaSubscriptionCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaSubscriptionCommand> {
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(  !hasSubscriptionKey() ) {
015         missingFields.add("subscriptionKey");
016      }
017      if( hasDestination() ) {
018         try {
019            getDestination().assertInitialized();
020         } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
021            missingFields.addAll(prefix(e.getMissingFields(),"destination."));
022         }
023      }
024      return missingFields;
025   }
026
027   public void clear() {
028      super.clear();
029      clearDestination();
030      clearSubscriptionKey();
031      clearRetroactive();
032      clearSubscriptionInfo();
033   }
034
035   public KahaSubscriptionCommand clone() {
036      return new KahaSubscriptionCommand().mergeFrom(this);
037   }
038
039   public KahaSubscriptionCommand mergeFrom(KahaSubscriptionCommand other) {
040      if (other.hasDestination()) {
041         if (hasDestination()) {
042            getDestination().mergeFrom(other.getDestination());
043         } else {
044            setDestination(other.getDestination().clone());
045         }
046      }
047      if (other.hasSubscriptionKey()) {
048         setSubscriptionKey(other.getSubscriptionKey());
049      }
050      if (other.hasRetroactive()) {
051         setRetroactive(other.getRetroactive());
052      }
053      if (other.hasSubscriptionInfo()) {
054         setSubscriptionInfo(other.getSubscriptionInfo());
055      }
056      return this;
057   }
058
059   public int serializedSizeUnframed() {
060      if (memoizedSerializedSize != -1)
061         return memoizedSerializedSize;
062
063      int size = 0;
064      if (hasDestination()) {
065         size += computeMessageSize(1, getDestination());
066      }
067      if (hasSubscriptionKey()) {
068         size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize(2, getSubscriptionKey());
069      }
070      if (hasRetroactive()) {
071         size += org.apache.activemq.protobuf.CodedOutputStream.computeBoolSize(3, getRetroactive());
072      }
073      if (hasSubscriptionInfo()) {
074         size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize(4, getSubscriptionInfo());
075      }
076      memoizedSerializedSize = size;
077      return size;
078   }
079
080   public KahaSubscriptionCommand mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
081      while (true) {
082         int tag = input.readTag();
083         if ((tag & 0x07) == 4) {
084            return this;
085         }
086         switch (tag) {
087         case 0:
088            return this;
089         default: {
090            break;
091         }
092         case 10:
093            if (hasDestination()) {
094               getDestination().mergeFramed(input);
095            } else {
096               setDestination(new KahaDestination().mergeFramed(input));
097            }
098            break;
099         case 18:
100            setSubscriptionKey(input.readString());
101            break;
102         case 24:
103            setRetroactive(input.readBool());
104            break;
105         case 34:
106            setSubscriptionInfo(input.readBytes());
107            break;
108         }
109      }
110   }
111   public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
112      if (hasDestination()) {
113         writeMessage(output, 1, getDestination());
114      }
115      if (hasSubscriptionKey()) {
116         output.writeString(2, getSubscriptionKey());
117      }
118      if (hasRetroactive()) {
119         output.writeBool(3, getRetroactive());
120      }
121      if (hasSubscriptionInfo()) {
122         output.writeBytes(4, getSubscriptionInfo());
123      }
124   }
125
126   public static KahaSubscriptionCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
127      return new KahaSubscriptionCommand().mergeUnframed(data).checktInitialized();
128   }
129
130   public static KahaSubscriptionCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
131      return new KahaSubscriptionCommand().mergeUnframed(data).checktInitialized();
132   }
133
134   public static KahaSubscriptionCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
135      return new KahaSubscriptionCommand().mergeUnframed(data).checktInitialized();
136   }
137
138   public static KahaSubscriptionCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
139      return new KahaSubscriptionCommand().mergeUnframed(data).checktInitialized();
140   }
141
142   public static KahaSubscriptionCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
143      return new KahaSubscriptionCommand().mergeFramed(data).checktInitialized();
144   }
145
146   public static KahaSubscriptionCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
147      return new KahaSubscriptionCommand().mergeFramed(data).checktInitialized();
148   }
149
150   public static KahaSubscriptionCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
151      return new KahaSubscriptionCommand().mergeFramed(data).checktInitialized();
152   }
153
154   public static KahaSubscriptionCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
155      return new KahaSubscriptionCommand().mergeFramed(data).checktInitialized();
156   }
157
158   public String toString() {
159      return toString(new java.lang.StringBuilder(), "").toString();
160   }
161
162   public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
163      if(  hasDestination() ) {
164         sb.append(prefix+"destination {\n");
165         getDestination().toString(sb, prefix+"  ");
166         sb.append(prefix+"}\n");
167      }
168      if(  hasSubscriptionKey() ) {
169         sb.append(prefix+"subscriptionKey: ");
170         sb.append(getSubscriptionKey());
171         sb.append("\n");
172      }
173      if(  hasRetroactive() ) {
174         sb.append(prefix+"retroactive: ");
175         sb.append(getRetroactive());
176         sb.append("\n");
177      }
178      if(  hasSubscriptionInfo() ) {
179         sb.append(prefix+"subscriptionInfo: ");
180         sb.append(getSubscriptionInfo());
181         sb.append("\n");
182      }
183      return sb;
184   }
185
186   public void visit(org.apache.activemq.store.kahadb.Visitor visitor) throws java.io.IOException {
187      visitor.visit(this);
188   }
189
190   public KahaEntryType type() {
191      return KahaEntryType.KAHA_SUBSCRIPTION_COMMAND;
192   }
193
194   public boolean equals(Object obj) {
195      if( obj==this )
196         return true;
197      
198      if( obj==null || obj.getClass()!=KahaSubscriptionCommand.class )
199         return false;
200      
201      return equals((KahaSubscriptionCommand)obj);
202   }
203   
204   public boolean equals(KahaSubscriptionCommand obj) {
205      if (hasDestination() ^ obj.hasDestination() ) 
206         return false;
207      if (hasDestination() && ( !getDestination().equals(obj.getDestination()) ))
208         return false;
209      if (hasSubscriptionKey() ^ obj.hasSubscriptionKey() ) 
210         return false;
211      if (hasSubscriptionKey() && ( !getSubscriptionKey().equals(obj.getSubscriptionKey()) ))
212         return false;
213      if (hasRetroactive() ^ obj.hasRetroactive() ) 
214         return false;
215      if (hasRetroactive() && ( getRetroactive()!=obj.getRetroactive() ))
216         return false;
217      if (hasSubscriptionInfo() ^ obj.hasSubscriptionInfo() ) 
218         return false;
219      if (hasSubscriptionInfo() && ( !getSubscriptionInfo().equals(obj.getSubscriptionInfo()) ))
220         return false;
221      return true;
222   }
223   
224   public int hashCode() {
225      int rc=172060159;
226      if (hasDestination()) {
227         rc ^= ( 238021614^getDestination().hashCode() );
228      }
229      if (hasSubscriptionKey()) {
230         rc ^= ( 1895830498^getSubscriptionKey().hashCode() );
231      }
232      if (hasRetroactive()) {
233         rc ^= ( 512121604^ (getRetroactive()? 3:-3) );
234      }
235      if (hasSubscriptionInfo()) {
236         rc ^= ( -1358848117^getSubscriptionInfo().hashCode() );
237      }
238      return rc;
239   }
240   
241}
242
243abstract class KahaSubscriptionCommandBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
244
245   // required KahaDestination destination = 1;
246   private KahaDestination f_destination = null;
247
248   public boolean hasDestination() {
249      return this.f_destination!=null;
250   }
251
252   public KahaDestination getDestination() {
253      if( this.f_destination == null ) {
254         this.f_destination = new KahaDestination();
255      }
256      return this.f_destination;
257   }
258
259   public T setDestination(KahaDestination destination) {
260      loadAndClear();
261      this.f_destination = destination;
262      return (T)this;
263   }
264
265   public void clearDestination() {
266      loadAndClear();
267      this.f_destination = null;
268   }
269
270   // required string subscriptionKey = 2;
271   private java.lang.String f_subscriptionKey = null;
272   private boolean b_subscriptionKey;
273
274   public boolean hasSubscriptionKey() {
275      return this.b_subscriptionKey;
276   }
277
278   public java.lang.String getSubscriptionKey() {
279      return this.f_subscriptionKey;
280   }
281
282   public T setSubscriptionKey(java.lang.String subscriptionKey) {
283      loadAndClear();
284      this.b_subscriptionKey = true;
285      this.f_subscriptionKey = subscriptionKey;
286      return (T)this;
287   }
288
289   public void clearSubscriptionKey() {
290      loadAndClear();
291      this.b_subscriptionKey = false;
292      this.f_subscriptionKey = null;
293   }
294
295   // optional bool retroactive = 3;
296   private boolean f_retroactive = false;
297   private boolean b_retroactive;
298
299   public boolean hasRetroactive() {
300      return this.b_retroactive;
301   }
302
303   public boolean getRetroactive() {
304      return this.f_retroactive;
305   }
306
307   public T setRetroactive(boolean retroactive) {
308      loadAndClear();
309      this.b_retroactive = true;
310      this.f_retroactive = retroactive;
311      return (T)this;
312   }
313
314   public void clearRetroactive() {
315      loadAndClear();
316      this.b_retroactive = false;
317      this.f_retroactive = false;
318   }
319
320   // optional bytes subscriptionInfo = 4;
321   private org.apache.activemq.protobuf.Buffer f_subscriptionInfo = null;
322   private boolean b_subscriptionInfo;
323
324   public boolean hasSubscriptionInfo() {
325      return this.b_subscriptionInfo;
326   }
327
328   public org.apache.activemq.protobuf.Buffer getSubscriptionInfo() {
329      return this.f_subscriptionInfo;
330   }
331
332   public T setSubscriptionInfo(org.apache.activemq.protobuf.Buffer subscriptionInfo) {
333      loadAndClear();
334      this.b_subscriptionInfo = true;
335      this.f_subscriptionInfo = subscriptionInfo;
336      return (T)this;
337   }
338
339   public void clearSubscriptionInfo() {
340      loadAndClear();
341      this.b_subscriptionInfo = false;
342      this.f_subscriptionInfo = null;
343   }
344
345}
346