001//
002// Generated by protoc, do not edit by hand.
003//
004package org.apache.activemq.leveldb.record;
005
006
007public class SubscriptionRecord implements org.fusesource.hawtbuf.proto.PBMessageFactory<SubscriptionRecord.Bean, SubscriptionRecord.Buffer> {
008
009   public static final SubscriptionRecord FACTORY = new SubscriptionRecord();
010   public static final org.fusesource.hawtbuf.proto.PBMessageFramedCodec<Buffer> FRAMED_CODEC = new org.fusesource.hawtbuf.proto.PBMessageFramedCodec<Buffer>(FACTORY);
011   public static final org.fusesource.hawtbuf.proto.PBMessageUnframedCodec<Buffer> UNFRAMED_CODEC = new org.fusesource.hawtbuf.proto.PBMessageUnframedCodec<Buffer>(FACTORY);
012
013   public Bean create()  {
014      return new Bean();
015   }
016
017   public Bean parseUnframed(org.fusesource.hawtbuf.proto.CodedInputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
018      return new Bean().mergeUnframed(data);
019   }
020
021   public Bean parseUnframed(java.io.InputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
022      return parseUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(data));
023   }
024
025   public Buffer parseUnframed(org.fusesource.hawtbuf.Buffer data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
026      return new Buffer(data);
027   }
028
029   public Buffer parseUnframed(byte[] data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
030      return parseUnframed(new org.fusesource.hawtbuf.Buffer(data));
031   }
032
033   public Buffer parseFramed(org.fusesource.hawtbuf.proto.CodedInputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
034      int length = data.readRawVarint32();
035      int oldLimit = data.pushLimit(length);
036      Buffer rc = parseUnframed(data.readRawBytes(length));
037      data.popLimit(oldLimit);
038      return rc;
039   }
040
041   public Buffer parseFramed(org.fusesource.hawtbuf.Buffer data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
042      try {
043         org.fusesource.hawtbuf.proto.CodedInputStream input = new org.fusesource.hawtbuf.proto.CodedInputStream(data);
044         Buffer rc = parseFramed(input);
045         input.checkLastTagWas(0);
046         return rc;
047      } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
048         throw e;
049      } catch (java.io.IOException e) {
050         throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
051      }
052   }
053
054   public Buffer parseFramed(byte[] data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
055      return parseFramed(new org.fusesource.hawtbuf.Buffer(data));
056   }
057
058   public Buffer parseFramed(java.io.InputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
059      return parseUnframed(org.fusesource.hawtbuf.proto.MessageBufferSupport.readFrame(data));
060   }
061
062   public interface Getter extends org.fusesource.hawtbuf.proto.PBMessage<SubscriptionRecord.Bean, SubscriptionRecord.Buffer> {
063
064      // optional int64 topic_key = 1;
065      public boolean hasTopicKey();
066      public long getTopicKey();
067      // optional string client_id = 2;
068      public boolean hasClientId();
069      public java.lang.String getClientId();
070      // optional string subscription_name = 3;
071      public boolean hasSubscriptionName();
072      public java.lang.String getSubscriptionName();
073      // optional string selector = 4;
074      public boolean hasSelector();
075      public java.lang.String getSelector();
076      // optional string destination_name = 5;
077      public boolean hasDestinationName();
078      public java.lang.String getDestinationName();
079      public Bean copy();
080      public Buffer freeze();
081      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix);
082   }
083
084   static public final class Bean implements Getter {
085
086      Buffer frozen;
087      Bean bean;
088
089      public Bean() {
090         this.bean = this;
091      }
092
093      public Bean(Bean copy) {
094         this.bean = copy;
095      }
096
097      public Bean copy() {
098         return new Bean(bean);
099      }
100
101      public boolean frozen() {
102         return frozen!=null;
103      }
104
105      public Buffer freeze() {
106         if( frozen==null ) {
107            frozen = new Buffer(bean);
108            assert deepFreeze();
109         }
110         return frozen;
111      }
112
113      private boolean deepFreeze() {
114         frozen.serializedSizeUnframed();
115         return true;
116      }
117
118      private void copyCheck() {
119         assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
120         if (bean != this) {
121            copy(bean);
122         }
123      }
124
125      private void copy(Bean other) {
126         this.bean = this;
127         this.f_topicKey = other.f_topicKey;
128         this.b_topicKey = other.b_topicKey;
129         this.f_clientId = other.f_clientId;
130         this.f_subscriptionName = other.f_subscriptionName;
131         this.f_selector = other.f_selector;
132         this.f_destinationName = other.f_destinationName;
133      }
134
135      // optional int64 topic_key = 1;
136      private long f_topicKey = 0;
137      private boolean b_topicKey;
138
139      public boolean hasTopicKey() {
140         return bean.b_topicKey;
141      }
142
143      public long getTopicKey() {
144         return bean.f_topicKey;
145      }
146
147      public Bean setTopicKey(long topicKey) {
148         copyCheck();
149         this.b_topicKey = true;
150         this.f_topicKey = topicKey;
151         return this;
152      }
153
154      public void clearTopicKey() {
155         copyCheck();
156         this.b_topicKey = false;
157         this.f_topicKey = 0;
158      }
159
160      // optional string client_id = 2;
161      private java.lang.String f_clientId = null;
162
163      public boolean hasClientId() {
164         return bean.f_clientId!=null;
165      }
166
167      public java.lang.String getClientId() {
168         return bean.f_clientId;
169      }
170
171      public Bean setClientId(java.lang.String clientId) {
172         copyCheck();
173         this.f_clientId = clientId;
174         return this;
175      }
176
177      public void clearClientId() {
178         copyCheck();
179         this.f_clientId = null;
180      }
181
182      // optional string subscription_name = 3;
183      private java.lang.String f_subscriptionName = null;
184
185      public boolean hasSubscriptionName() {
186         return bean.f_subscriptionName!=null;
187      }
188
189      public java.lang.String getSubscriptionName() {
190         return bean.f_subscriptionName;
191      }
192
193      public Bean setSubscriptionName(java.lang.String subscriptionName) {
194         copyCheck();
195         this.f_subscriptionName = subscriptionName;
196         return this;
197      }
198
199      public void clearSubscriptionName() {
200         copyCheck();
201         this.f_subscriptionName = null;
202      }
203
204      // optional string selector = 4;
205      private java.lang.String f_selector = null;
206
207      public boolean hasSelector() {
208         return bean.f_selector!=null;
209      }
210
211      public java.lang.String getSelector() {
212         return bean.f_selector;
213      }
214
215      public Bean setSelector(java.lang.String selector) {
216         copyCheck();
217         this.f_selector = selector;
218         return this;
219      }
220
221      public void clearSelector() {
222         copyCheck();
223         this.f_selector = null;
224      }
225
226      // optional string destination_name = 5;
227      private java.lang.String f_destinationName = null;
228
229      public boolean hasDestinationName() {
230         return bean.f_destinationName!=null;
231      }
232
233      public java.lang.String getDestinationName() {
234         return bean.f_destinationName;
235      }
236
237      public Bean setDestinationName(java.lang.String destinationName) {
238         copyCheck();
239         this.f_destinationName = destinationName;
240         return this;
241      }
242
243      public void clearDestinationName() {
244         copyCheck();
245         this.f_destinationName = null;
246      }
247
248      public String toString() {
249         return toString(new java.lang.StringBuilder(), "").toString();
250      }
251
252      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
253         if(  hasTopicKey() ) {
254            sb.append(prefix+"topic_key: ");
255            sb.append(getTopicKey());
256            sb.append("\n");
257         }
258         if(  hasClientId() ) {
259            sb.append(prefix+"client_id: ");
260            sb.append(getClientId());
261            sb.append("\n");
262         }
263         if(  hasSubscriptionName() ) {
264            sb.append(prefix+"subscription_name: ");
265            sb.append(getSubscriptionName());
266            sb.append("\n");
267         }
268         if(  hasSelector() ) {
269            sb.append(prefix+"selector: ");
270            sb.append(getSelector());
271            sb.append("\n");
272         }
273         if(  hasDestinationName() ) {
274            sb.append(prefix+"destination_name: ");
275            sb.append(getDestinationName());
276            sb.append("\n");
277         }
278         return sb;
279      }
280
281      public Bean mergeUnframed(java.io.InputStream input) throws java.io.IOException {
282         return mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(input));
283      }
284
285      public Bean mergeUnframed(org.fusesource.hawtbuf.proto.CodedInputStream input) throws java.io.IOException {
286         copyCheck();
287         while (true) {
288            int tag = input.readTag();
289            if ((tag & 0x07) == 4) {
290               return this;
291            }
292            switch (tag) {
293            case 0:
294               return this;
295            default: {
296               input.skipField(tag);
297               break;
298            }
299            case 8:
300               setTopicKey(input.readInt64());
301               break;
302            case 18:
303               setClientId(input.readString());
304               break;
305            case 26:
306               setSubscriptionName(input.readString());
307               break;
308            case 34:
309               setSelector(input.readString());
310               break;
311            case 42:
312               setDestinationName(input.readString());
313               break;
314            }
315         }
316      }
317      public boolean equals(Object obj) {
318         if( obj==this )
319            return true;
320         
321         if( obj==null || obj.getClass()!=Bean.class )
322            return false;
323         
324         return equals((Bean)obj);
325      }
326      
327      public boolean equals(Bean obj) {
328         if (hasTopicKey() ^ obj.hasTopicKey() ) 
329            return false;
330         if (hasTopicKey() && ( getTopicKey()!=obj.getTopicKey() ))
331            return false;
332         if (hasClientId() ^ obj.hasClientId() ) 
333            return false;
334         if (hasClientId() && ( !getClientId().equals(obj.getClientId()) ))
335            return false;
336         if (hasSubscriptionName() ^ obj.hasSubscriptionName() ) 
337            return false;
338         if (hasSubscriptionName() && ( !getSubscriptionName().equals(obj.getSubscriptionName()) ))
339            return false;
340         if (hasSelector() ^ obj.hasSelector() ) 
341            return false;
342         if (hasSelector() && ( !getSelector().equals(obj.getSelector()) ))
343            return false;
344         if (hasDestinationName() ^ obj.hasDestinationName() ) 
345            return false;
346         if (hasDestinationName() && ( !getDestinationName().equals(obj.getDestinationName()) ))
347            return false;
348         return true;
349      }
350      
351      public int hashCode() {
352         int rc=2066384;
353         if (hasTopicKey()) {
354            rc ^= ( -892667184^(new Long(getTopicKey())).hashCode() );
355         }
356         if (hasClientId()) {
357            rc ^= ( 973052518^getClientId().hashCode() );
358         }
359         if (hasSubscriptionName()) {
360            rc ^= ( -1358711448^getSubscriptionName().hashCode() );
361         }
362         if (hasSelector()) {
363            rc ^= ( 1256216575^getSelector().hashCode() );
364         }
365         if (hasDestinationName()) {
366            rc ^= ( 1535194009^getDestinationName().hashCode() );
367         }
368         return rc;
369      }
370      
371      public Bean mergeFrom(Getter other) {
372         copyCheck();
373         if (other.hasTopicKey()) {
374            setTopicKey(other.getTopicKey());
375         }
376         if (other.hasClientId()) {
377            setClientId(other.getClientId());
378         }
379         if (other.hasSubscriptionName()) {
380            setSubscriptionName(other.getSubscriptionName());
381         }
382         if (other.hasSelector()) {
383            setSelector(other.getSelector());
384         }
385         if (other.hasDestinationName()) {
386            setDestinationName(other.getDestinationName());
387         }
388         return this;
389      }
390
391      public void clear() {
392         clearTopicKey();
393         clearClientId();
394         clearSubscriptionName();
395         clearSelector();
396         clearDestinationName();
397      }
398
399      public void readExternal(java.io.DataInput in) throws java.io.IOException {
400         assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
401         bean = this;
402         frozen = null;
403         f_topicKey = in.readLong();
404         b_topicKey = true;
405         if( in.readBoolean() ) {
406            f_clientId = in.readUTF();
407         } else {
408            f_clientId = null;
409         }
410         if( in.readBoolean() ) {
411            f_subscriptionName = in.readUTF();
412         } else {
413            f_subscriptionName = null;
414         }
415         if( in.readBoolean() ) {
416            f_selector = in.readUTF();
417         } else {
418            f_selector = null;
419         }
420         if( in.readBoolean() ) {
421            f_destinationName = in.readUTF();
422         } else {
423            f_destinationName = null;
424         }
425      }
426
427      public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
428         out.writeLong(bean.f_topicKey);
429         if( bean.f_clientId!=null ) {
430            out.writeBoolean(true);
431            out.writeUTF(bean.f_clientId);
432         } else {
433            out.writeBoolean(false);
434         }
435         if( bean.f_subscriptionName!=null ) {
436            out.writeBoolean(true);
437            out.writeUTF(bean.f_subscriptionName);
438         } else {
439            out.writeBoolean(false);
440         }
441         if( bean.f_selector!=null ) {
442            out.writeBoolean(true);
443            out.writeUTF(bean.f_selector);
444         } else {
445            out.writeBoolean(false);
446         }
447         if( bean.f_destinationName!=null ) {
448            out.writeBoolean(true);
449            out.writeUTF(bean.f_destinationName);
450         } else {
451            out.writeBoolean(false);
452         }
453      }
454
455   }
456
457   static public final class Buffer implements org.fusesource.hawtbuf.proto.MessageBuffer<SubscriptionRecord.Bean, SubscriptionRecord.Buffer>, Getter {
458
459      private Bean bean;
460      private org.fusesource.hawtbuf.Buffer buffer;
461      private int size=-1;
462      private int hashCode;
463
464      private Buffer(org.fusesource.hawtbuf.Buffer buffer) {
465         this.buffer = buffer;
466      }
467
468      private Buffer(Bean bean) {
469         this.bean = bean;
470      }
471
472      public Bean copy() {
473         return bean().copy();
474      }
475
476      public Buffer freeze() {
477         return this;
478      }
479
480      private Bean bean() {
481         if (bean == null) {
482            try {
483               bean = new Bean().mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(buffer));
484               bean.frozen=this;
485            } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
486               throw new RuntimeException(e);
487            } catch (java.io.IOException e) {
488               throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
489            }
490         }
491         return bean;
492      }
493
494      public String toString() {
495         return bean().toString();
496      }
497
498      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
499         return bean().toString(sb, prefix);
500      }
501
502      // optional int64 topic_key = 1;
503      public boolean hasTopicKey() {
504         return bean().hasTopicKey();
505      }
506
507      public long getTopicKey() {
508         return bean().getTopicKey();
509      }
510
511      // optional string client_id = 2;
512      public boolean hasClientId() {
513         return bean().hasClientId();
514      }
515
516      public java.lang.String getClientId() {
517         return bean().getClientId();
518      }
519
520      // optional string subscription_name = 3;
521      public boolean hasSubscriptionName() {
522         return bean().hasSubscriptionName();
523      }
524
525      public java.lang.String getSubscriptionName() {
526         return bean().getSubscriptionName();
527      }
528
529      // optional string selector = 4;
530      public boolean hasSelector() {
531         return bean().hasSelector();
532      }
533
534      public java.lang.String getSelector() {
535         return bean().getSelector();
536      }
537
538      // optional string destination_name = 5;
539      public boolean hasDestinationName() {
540         return bean().hasDestinationName();
541      }
542
543      public java.lang.String getDestinationName() {
544         return bean().getDestinationName();
545      }
546
547      public org.fusesource.hawtbuf.Buffer toUnframedBuffer() {
548         if( buffer !=null ) {
549            return buffer;
550         }
551         return org.fusesource.hawtbuf.proto.MessageBufferSupport.toUnframedBuffer(this);
552      }
553
554      public org.fusesource.hawtbuf.Buffer toFramedBuffer() {
555         return org.fusesource.hawtbuf.proto.MessageBufferSupport.toFramedBuffer(this);
556      }
557
558      public byte[] toUnframedByteArray() {
559         return toUnframedBuffer().toByteArray();
560      }
561
562      public byte[] toFramedByteArray() {
563         return toFramedBuffer().toByteArray();
564      }
565
566      public void writeFramed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
567         output.writeRawVarint32(serializedSizeUnframed());
568         writeUnframed(output);
569      }
570
571      public void writeFramed(java.io.OutputStream output) throws java.io.IOException {
572         org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
573         writeFramed(codedOutput);
574         codedOutput.flush();
575      }
576
577      public void writeUnframed(java.io.OutputStream output) throws java.io.IOException {
578         org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
579         writeUnframed(codedOutput);
580         codedOutput.flush();
581      }
582
583      public void writeUnframed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
584         if (buffer == null) {
585            int size = serializedSizeUnframed();
586            buffer = output.getNextBuffer(size);
587            org.fusesource.hawtbuf.proto.CodedOutputStream original=null;
588            if( buffer == null ) {
589               buffer = new org.fusesource.hawtbuf.Buffer(new byte[size]);
590               original = output;
591               output = new org.fusesource.hawtbuf.proto.CodedOutputStream(buffer);
592            }
593            if (bean.hasTopicKey()) {
594               output.writeInt64(1, bean.getTopicKey());
595            }
596            if (bean.hasClientId()) {
597               output.writeString(2, bean.getClientId());
598            }
599            if (bean.hasSubscriptionName()) {
600               output.writeString(3, bean.getSubscriptionName());
601            }
602            if (bean.hasSelector()) {
603               output.writeString(4, bean.getSelector());
604            }
605            if (bean.hasDestinationName()) {
606               output.writeString(5, bean.getDestinationName());
607            }
608            if( original !=null ) {
609               output.checkNoSpaceLeft();
610               output = original;
611               output.writeRawBytes(buffer);
612            }
613         } else {
614            output.writeRawBytes(buffer);
615         }
616      }
617
618      public int serializedSizeFramed() {
619         int t = serializedSizeUnframed();
620         return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t;
621      }
622
623      public int serializedSizeUnframed() {
624         if (buffer != null) {
625            return buffer.length;
626         }
627         if (size != -1)
628            return size;
629
630         size = 0;
631         if (hasTopicKey()) {
632            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(1, getTopicKey());
633         }
634         if (hasClientId()) {
635            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(2, getClientId());
636         }
637         if (hasSubscriptionName()) {
638            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(3, getSubscriptionName());
639         }
640         if (hasSelector()) {
641            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(4, getSelector());
642         }
643         if (hasDestinationName()) {
644            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(5, getDestinationName());
645         }
646         return size;
647      }
648
649      public boolean equals(Object obj) {
650         if( obj==this )
651            return true;
652         
653         if( obj==null || obj.getClass()!=Buffer.class )
654            return false;
655         
656         return equals((Buffer)obj);
657      }
658      
659      public boolean equals(Buffer obj) {
660         return toUnframedBuffer().equals(obj.toUnframedBuffer());
661      }
662      
663      public int hashCode() {
664         if( hashCode==0 ) {
665         hashCode=2000715872 ^ toUnframedBuffer().hashCode();
666         }
667         return hashCode;
668      }
669      
670      public boolean frozen() {
671         return true;
672      }
673   }
674
675}
676