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