001    //
002    // Generated by protoc, do not edit by hand.
003    //
004    package org.apache.activemq.leveldb.record;
005    
006    
007    public 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                   break;
297                }
298                case 8:
299                   setTopicKey(input.readInt64());
300                   break;
301                case 18:
302                   setClientId(input.readString());
303                   break;
304                case 26:
305                   setSubscriptionName(input.readString());
306                   break;
307                case 34:
308                   setSelector(input.readString());
309                   break;
310                case 42:
311                   setDestinationName(input.readString());
312                   break;
313                }
314             }
315          }
316          public boolean equals(Object obj) {
317             if( obj==this )
318                return true;
319             
320             if( obj==null || obj.getClass()!=Bean.class )
321                return false;
322             
323             return equals((Bean)obj);
324          }
325          
326          public boolean equals(Bean obj) {
327             if (hasTopicKey() ^ obj.hasTopicKey() ) 
328                return false;
329             if (hasTopicKey() && ( getTopicKey()!=obj.getTopicKey() ))
330                return false;
331             if (hasClientId() ^ obj.hasClientId() ) 
332                return false;
333             if (hasClientId() && ( !getClientId().equals(obj.getClientId()) ))
334                return false;
335             if (hasSubscriptionName() ^ obj.hasSubscriptionName() ) 
336                return false;
337             if (hasSubscriptionName() && ( !getSubscriptionName().equals(obj.getSubscriptionName()) ))
338                return false;
339             if (hasSelector() ^ obj.hasSelector() ) 
340                return false;
341             if (hasSelector() && ( !getSelector().equals(obj.getSelector()) ))
342                return false;
343             if (hasDestinationName() ^ obj.hasDestinationName() ) 
344                return false;
345             if (hasDestinationName() && ( !getDestinationName().equals(obj.getDestinationName()) ))
346                return false;
347             return true;
348          }
349          
350          public int hashCode() {
351             int rc=2066384;
352             if (hasTopicKey()) {
353                rc ^= ( -892667184^(new Long(getTopicKey())).hashCode() );
354             }
355             if (hasClientId()) {
356                rc ^= ( 973052518^getClientId().hashCode() );
357             }
358             if (hasSubscriptionName()) {
359                rc ^= ( -1358711448^getSubscriptionName().hashCode() );
360             }
361             if (hasSelector()) {
362                rc ^= ( 1256216575^getSelector().hashCode() );
363             }
364             if (hasDestinationName()) {
365                rc ^= ( 1535194009^getDestinationName().hashCode() );
366             }
367             return rc;
368          }
369          
370          public Bean mergeFrom(Getter other) {
371             copyCheck();
372             if (other.hasTopicKey()) {
373                setTopicKey(other.getTopicKey());
374             }
375             if (other.hasClientId()) {
376                setClientId(other.getClientId());
377             }
378             if (other.hasSubscriptionName()) {
379                setSubscriptionName(other.getSubscriptionName());
380             }
381             if (other.hasSelector()) {
382                setSelector(other.getSelector());
383             }
384             if (other.hasDestinationName()) {
385                setDestinationName(other.getDestinationName());
386             }
387             return this;
388          }
389    
390          public void clear() {
391             clearTopicKey();
392             clearClientId();
393             clearSubscriptionName();
394             clearSelector();
395             clearDestinationName();
396          }
397    
398          public void readExternal(java.io.DataInput in) throws java.io.IOException {
399             assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
400             bean = this;
401             frozen = null;
402             f_topicKey = in.readLong();
403             b_topicKey = true;
404             if( in.readBoolean() ) {
405                f_clientId = in.readUTF();
406             } else {
407                f_clientId = null;
408             }
409             if( in.readBoolean() ) {
410                f_subscriptionName = in.readUTF();
411             } else {
412                f_subscriptionName = null;
413             }
414             if( in.readBoolean() ) {
415                f_selector = in.readUTF();
416             } else {
417                f_selector = null;
418             }
419             if( in.readBoolean() ) {
420                f_destinationName = in.readUTF();
421             } else {
422                f_destinationName = null;
423             }
424          }
425    
426          public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
427             out.writeLong(bean.f_topicKey);
428             if( bean.f_clientId!=null ) {
429                out.writeBoolean(true);
430                out.writeUTF(bean.f_clientId);
431             } else {
432                out.writeBoolean(false);
433             }
434             if( bean.f_subscriptionName!=null ) {
435                out.writeBoolean(true);
436                out.writeUTF(bean.f_subscriptionName);
437             } else {
438                out.writeBoolean(false);
439             }
440             if( bean.f_selector!=null ) {
441                out.writeBoolean(true);
442                out.writeUTF(bean.f_selector);
443             } else {
444                out.writeBoolean(false);
445             }
446             if( bean.f_destinationName!=null ) {
447                out.writeBoolean(true);
448                out.writeUTF(bean.f_destinationName);
449             } else {
450                out.writeBoolean(false);
451             }
452          }
453    
454       }
455    
456       static public final class Buffer implements org.fusesource.hawtbuf.proto.MessageBuffer<SubscriptionRecord.Bean, SubscriptionRecord.Buffer>, Getter {
457    
458          private Bean bean;
459          private org.fusesource.hawtbuf.Buffer buffer;
460          private int size=-1;
461          private int hashCode;
462    
463          private Buffer(org.fusesource.hawtbuf.Buffer buffer) {
464             this.buffer = buffer;
465          }
466    
467          private Buffer(Bean bean) {
468             this.bean = bean;
469          }
470    
471          public Bean copy() {
472             return bean().copy();
473          }
474    
475          public Buffer freeze() {
476             return this;
477          }
478    
479          private Bean bean() {
480             if (bean == null) {
481                try {
482                   bean = new Bean().mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(buffer));
483                   bean.frozen=this;
484                } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
485                   throw new RuntimeException(e);
486                } catch (java.io.IOException e) {
487                   throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
488                }
489             }
490             return bean;
491          }
492    
493          public String toString() {
494             return bean().toString();
495          }
496    
497          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
498             return bean().toString(sb, prefix);
499          }
500    
501          // optional int64 topic_key = 1;
502          public boolean hasTopicKey() {
503             return bean().hasTopicKey();
504          }
505    
506          public long getTopicKey() {
507             return bean().getTopicKey();
508          }
509    
510          // optional string client_id = 2;
511          public boolean hasClientId() {
512             return bean().hasClientId();
513          }
514    
515          public java.lang.String getClientId() {
516             return bean().getClientId();
517          }
518    
519          // optional string subscription_name = 3;
520          public boolean hasSubscriptionName() {
521             return bean().hasSubscriptionName();
522          }
523    
524          public java.lang.String getSubscriptionName() {
525             return bean().getSubscriptionName();
526          }
527    
528          // optional string selector = 4;
529          public boolean hasSelector() {
530             return bean().hasSelector();
531          }
532    
533          public java.lang.String getSelector() {
534             return bean().getSelector();
535          }
536    
537          // optional string destination_name = 5;
538          public boolean hasDestinationName() {
539             return bean().hasDestinationName();
540          }
541    
542          public java.lang.String getDestinationName() {
543             return bean().getDestinationName();
544          }
545    
546          public org.fusesource.hawtbuf.Buffer toUnframedBuffer() {
547             if( buffer !=null ) {
548                return buffer;
549             }
550             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toUnframedBuffer(this);
551          }
552    
553          public org.fusesource.hawtbuf.Buffer toFramedBuffer() {
554             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toFramedBuffer(this);
555          }
556    
557          public byte[] toUnframedByteArray() {
558             return toUnframedBuffer().toByteArray();
559          }
560    
561          public byte[] toFramedByteArray() {
562             return toFramedBuffer().toByteArray();
563          }
564    
565          public void writeFramed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
566             output.writeRawVarint32(serializedSizeUnframed());
567             writeUnframed(output);
568          }
569    
570          public void writeFramed(java.io.OutputStream output) throws java.io.IOException {
571             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
572             writeFramed(codedOutput);
573             codedOutput.flush();
574          }
575    
576          public void writeUnframed(java.io.OutputStream output) throws java.io.IOException {
577             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
578             writeUnframed(codedOutput);
579             codedOutput.flush();
580          }
581    
582          public void writeUnframed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
583             if (buffer == null) {
584                int size = serializedSizeUnframed();
585                buffer = output.getNextBuffer(size);
586                org.fusesource.hawtbuf.proto.CodedOutputStream original=null;
587                if( buffer == null ) {
588                   buffer = new org.fusesource.hawtbuf.Buffer(new byte[size]);
589                   original = output;
590                   output = new org.fusesource.hawtbuf.proto.CodedOutputStream(buffer);
591                }
592                if (bean.hasTopicKey()) {
593                   output.writeInt64(1, bean.getTopicKey());
594                }
595                if (bean.hasClientId()) {
596                   output.writeString(2, bean.getClientId());
597                }
598                if (bean.hasSubscriptionName()) {
599                   output.writeString(3, bean.getSubscriptionName());
600                }
601                if (bean.hasSelector()) {
602                   output.writeString(4, bean.getSelector());
603                }
604                if (bean.hasDestinationName()) {
605                   output.writeString(5, bean.getDestinationName());
606                }
607                if( original !=null ) {
608                   output.checkNoSpaceLeft();
609                   output = original;
610                   output.writeRawBytes(buffer);
611                }
612             } else {
613                output.writeRawBytes(buffer);
614             }
615          }
616    
617          public int serializedSizeFramed() {
618             int t = serializedSizeUnframed();
619             return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t;
620          }
621    
622          public int serializedSizeUnframed() {
623             if (buffer != null) {
624                return buffer.length;
625             }
626             if (size != -1)
627                return size;
628    
629             size = 0;
630             if (hasTopicKey()) {
631                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(1, getTopicKey());
632             }
633             if (hasClientId()) {
634                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(2, getClientId());
635             }
636             if (hasSubscriptionName()) {
637                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(3, getSubscriptionName());
638             }
639             if (hasSelector()) {
640                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(4, getSelector());
641             }
642             if (hasDestinationName()) {
643                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeStringSize(5, getDestinationName());
644             }
645             return size;
646          }
647    
648          public boolean equals(Object obj) {
649             if( obj==this )
650                return true;
651             
652             if( obj==null || obj.getClass()!=Buffer.class )
653                return false;
654             
655             return equals((Buffer)obj);
656          }
657          
658          public boolean equals(Buffer obj) {
659             return toUnframedBuffer().equals(obj.toUnframedBuffer());
660          }
661          
662          public int hashCode() {
663             if( hashCode==0 ) {
664             hashCode=2000715872 ^ toUnframedBuffer().hashCode();
665             }
666             return hashCode;
667          }
668          
669          public boolean frozen() {
670             return true;
671          }
672       }
673    
674    }
675