001    //
002    // Generated by protoc, do not edit by hand.
003    //
004    package org.apache.activemq.console.command.store.proto;
005    
006    
007    public class QueuePB implements org.fusesource.hawtbuf.proto.PBMessageFactory<QueuePB.Bean, QueuePB.Buffer> {
008    
009       public static final QueuePB FACTORY = new QueuePB();
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<QueuePB.Bean, QueuePB.Buffer> {
063    
064          // required int64 key = 1;
065          public boolean hasKey();
066          public long getKey();
067          // optional bytes binding_kind = 2;
068          public boolean hasBindingKind();
069          public org.fusesource.hawtbuf.AsciiBuffer getBindingKind();
070          // optional bytes binding_data = 3;
071          public boolean hasBindingData();
072          public org.fusesource.hawtbuf.Buffer getBindingData();
073          public Bean copy();
074          public Buffer freeze();
075          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix);
076       }
077    
078       static public final class Bean implements Getter {
079    
080          Buffer frozen;
081          Bean bean;
082    
083          public Bean() {
084             this.bean = this;
085          }
086    
087          public Bean(Bean copy) {
088             this.bean = copy;
089          }
090    
091          public Bean copy() {
092             return new Bean(bean);
093          }
094    
095          public boolean frozen() {
096             return frozen!=null;
097          }
098    
099          public Buffer freeze() {
100             if( frozen==null ) {
101                frozen = new Buffer(bean);
102                assert deepFreeze();
103             }
104             return frozen;
105          }
106    
107          private boolean deepFreeze() {
108             frozen.serializedSizeUnframed();
109             return true;
110          }
111    
112          private void copyCheck() {
113             assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
114             if (bean != this) {
115                copy(bean);
116             }
117          }
118    
119          private void copy(Bean other) {
120             this.bean = this;
121             this.f_key = other.f_key;
122             this.b_key = other.b_key;
123             this.f_bindingKind = other.f_bindingKind;
124             this.f_bindingData = other.f_bindingData;
125          }
126    
127          // required int64 key = 1;
128          private long f_key = 0;
129          private boolean b_key;
130    
131          public boolean hasKey() {
132             return bean.b_key;
133          }
134    
135          public long getKey() {
136             return bean.f_key;
137          }
138    
139          public Bean setKey(long key) {
140             copyCheck();
141             this.b_key = true;
142             this.f_key = key;
143             return this;
144          }
145    
146          public void clearKey() {
147             copyCheck();
148             this.b_key = false;
149             this.f_key = 0;
150          }
151    
152          // optional bytes binding_kind = 2;
153          private org.fusesource.hawtbuf.AsciiBuffer f_bindingKind = null;
154    
155          public boolean hasBindingKind() {
156             return bean.f_bindingKind!=null;
157          }
158    
159          public org.fusesource.hawtbuf.AsciiBuffer getBindingKind() {
160             return bean.f_bindingKind;
161          }
162    
163          public Bean setBindingKind(org.fusesource.hawtbuf.AsciiBuffer bindingKind) {
164             copyCheck();
165             this.f_bindingKind = bindingKind;
166             return this;
167          }
168    
169          public void clearBindingKind() {
170             copyCheck();
171             this.f_bindingKind = null;
172          }
173    
174          // optional bytes binding_data = 3;
175          private org.fusesource.hawtbuf.Buffer f_bindingData = null;
176    
177          public boolean hasBindingData() {
178             return bean.f_bindingData!=null;
179          }
180    
181          public org.fusesource.hawtbuf.Buffer getBindingData() {
182             return bean.f_bindingData;
183          }
184    
185          public Bean setBindingData(org.fusesource.hawtbuf.Buffer bindingData) {
186             copyCheck();
187             this.f_bindingData = bindingData;
188             return this;
189          }
190    
191          public void clearBindingData() {
192             copyCheck();
193             this.f_bindingData = null;
194          }
195    
196          public String toString() {
197             return toString(new java.lang.StringBuilder(), "").toString();
198          }
199    
200          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
201             if(  hasKey() ) {
202                sb.append(prefix+"key: ");
203                sb.append(getKey());
204                sb.append("\n");
205             }
206             if(  hasBindingKind() ) {
207                sb.append(prefix+"binding_kind: ");
208                sb.append(getBindingKind());
209                sb.append("\n");
210             }
211             if(  hasBindingData() ) {
212                sb.append(prefix+"binding_data: ");
213                sb.append(getBindingData());
214                sb.append("\n");
215             }
216             return sb;
217          }
218    
219          public Bean mergeUnframed(java.io.InputStream input) throws java.io.IOException {
220             return mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(input));
221          }
222    
223          public Bean mergeUnframed(org.fusesource.hawtbuf.proto.CodedInputStream input) throws java.io.IOException {
224             copyCheck();
225             while (true) {
226                int tag = input.readTag();
227                if ((tag & 0x07) == 4) {
228                   return this;
229                }
230                switch (tag) {
231                case 0:
232                   return this;
233                default: {
234                   break;
235                }
236                case 8:
237                   setKey(input.readInt64());
238                   break;
239                case 18:
240                   setBindingKind(new org.fusesource.hawtbuf.AsciiBuffer(input.readBytes()));
241                   break;
242                case 26:
243                   setBindingData(input.readBytes());
244                   break;
245                }
246             }
247          }
248          public boolean equals(Object obj) {
249             if( obj==this )
250                return true;
251             
252             if( obj==null || obj.getClass()!=Bean.class )
253                return false;
254             
255             return equals((Bean)obj);
256          }
257          
258          public boolean equals(Bean obj) {
259             if (hasKey() ^ obj.hasKey() ) 
260                return false;
261             if (hasKey() && ( getKey()!=obj.getKey() ))
262                return false;
263             if (hasBindingKind() ^ obj.hasBindingKind() ) 
264                return false;
265             if (hasBindingKind() && ( !getBindingKind().equals(obj.getBindingKind()) ))
266                return false;
267             if (hasBindingData() ^ obj.hasBindingData() ) 
268                return false;
269             if (hasBindingData() && ( !getBindingData().equals(obj.getBindingData()) ))
270                return false;
271             return true;
272          }
273          
274          public int hashCode() {
275             int rc=2066384;
276             if (hasKey()) {
277                rc ^= ( 75327^(new Long(getKey())).hashCode() );
278             }
279             if (hasBindingKind()) {
280                rc ^= ( 1382366105^getBindingKind().hashCode() );
281             }
282             if (hasBindingData()) {
283                rc ^= ( 1382150063^getBindingData().hashCode() );
284             }
285             return rc;
286          }
287          
288          public Bean mergeFrom(Getter other) {
289             copyCheck();
290             if (other.hasKey()) {
291                setKey(other.getKey());
292             }
293             if (other.hasBindingKind()) {
294                setBindingKind(other.getBindingKind());
295             }
296             if (other.hasBindingData()) {
297                setBindingData(other.getBindingData());
298             }
299             return this;
300          }
301    
302          public void clear() {
303             clearKey();
304             clearBindingKind();
305             clearBindingData();
306          }
307    
308          public void readExternal(java.io.DataInput in) throws java.io.IOException {
309             assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
310             bean = this;
311             frozen = null;
312             f_key = in.readLong();
313             b_key = true;
314             {
315                int size = in.readInt();
316                if( size>=0 ) {
317                   byte b[] = new byte[size];
318                   in.readFully(b);
319                   f_bindingKind = new org.fusesource.hawtbuf.AsciiBuffer(b);
320                } else {
321                   f_bindingKind = null;
322                }
323             }
324             {
325                int size = in.readInt();
326                if( size>=0 ) {
327                   byte b[] = new byte[size];
328                   in.readFully(b);
329                   f_bindingData = new org.fusesource.hawtbuf.Buffer(b);
330                } else {
331                   f_bindingData = null;
332                }
333             }
334          }
335    
336          public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
337             out.writeLong(bean.f_key);
338             if( bean.f_bindingKind!=null ) {
339                out.writeInt(bean.f_bindingKind.getLength());
340                out.write(bean.f_bindingKind.getData(), bean.f_bindingKind.getOffset(), bean.f_bindingKind.getLength());
341             } else {
342                out.writeInt(-1);
343             }
344             if( bean.f_bindingData!=null ) {
345                out.writeInt(bean.f_bindingData.getLength());
346                out.write(bean.f_bindingData.getData(), bean.f_bindingData.getOffset(), bean.f_bindingData.getLength());
347             } else {
348                out.writeInt(-1);
349             }
350          }
351    
352       }
353    
354       static public final class Buffer implements org.fusesource.hawtbuf.proto.MessageBuffer<QueuePB.Bean, QueuePB.Buffer>, Getter {
355    
356          private Bean bean;
357          private org.fusesource.hawtbuf.Buffer buffer;
358          private int size=-1;
359          private int hashCode;
360    
361          private Buffer(org.fusesource.hawtbuf.Buffer buffer) {
362             this.buffer = buffer;
363          }
364    
365          private Buffer(Bean bean) {
366             this.bean = bean;
367          }
368    
369          public Bean copy() {
370             return bean().copy();
371          }
372    
373          public Buffer freeze() {
374             return this;
375          }
376    
377          private Bean bean() {
378             if (bean == null) {
379                try {
380                   bean = new Bean().mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(buffer));
381                   bean.frozen=this;
382                } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
383                   throw new RuntimeException(e);
384                } catch (java.io.IOException e) {
385                   throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
386                }
387             }
388             return bean;
389          }
390    
391          public String toString() {
392             return bean().toString();
393          }
394    
395          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
396             return bean().toString(sb, prefix);
397          }
398    
399          // required int64 key = 1;
400          public boolean hasKey() {
401             return bean().hasKey();
402          }
403    
404          public long getKey() {
405             return bean().getKey();
406          }
407    
408          // optional bytes binding_kind = 2;
409          public boolean hasBindingKind() {
410             return bean().hasBindingKind();
411          }
412    
413          public org.fusesource.hawtbuf.AsciiBuffer getBindingKind() {
414             return bean().getBindingKind();
415          }
416    
417          // optional bytes binding_data = 3;
418          public boolean hasBindingData() {
419             return bean().hasBindingData();
420          }
421    
422          public org.fusesource.hawtbuf.Buffer getBindingData() {
423             return bean().getBindingData();
424          }
425    
426          public org.fusesource.hawtbuf.Buffer toUnframedBuffer() {
427             if( buffer !=null ) {
428                return buffer;
429             }
430             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toUnframedBuffer(this);
431          }
432    
433          public org.fusesource.hawtbuf.Buffer toFramedBuffer() {
434             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toFramedBuffer(this);
435          }
436    
437          public byte[] toUnframedByteArray() {
438             return toUnframedBuffer().toByteArray();
439          }
440    
441          public byte[] toFramedByteArray() {
442             return toFramedBuffer().toByteArray();
443          }
444    
445          public void writeFramed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
446             output.writeRawVarint32(serializedSizeUnframed());
447             writeUnframed(output);
448          }
449    
450          public void writeFramed(java.io.OutputStream output) throws java.io.IOException {
451             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
452             writeFramed(codedOutput);
453             codedOutput.flush();
454          }
455    
456          public void writeUnframed(java.io.OutputStream output) throws java.io.IOException {
457             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
458             writeUnframed(codedOutput);
459             codedOutput.flush();
460          }
461    
462          public void writeUnframed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
463             if (buffer == null) {
464                int size = serializedSizeUnframed();
465                buffer = output.getNextBuffer(size);
466                org.fusesource.hawtbuf.proto.CodedOutputStream original=null;
467                if( buffer == null ) {
468                   buffer = new org.fusesource.hawtbuf.Buffer(new byte[size]);
469                   original = output;
470                   output = new org.fusesource.hawtbuf.proto.CodedOutputStream(buffer);
471                }
472                output.writeInt64(1, bean.getKey());
473                if (bean.hasBindingKind()) {
474                   output.writeBytes(2, bean.getBindingKind());
475                }
476                if (bean.hasBindingData()) {
477                   output.writeBytes(3, bean.getBindingData());
478                }
479                if( original !=null ) {
480                   output.checkNoSpaceLeft();
481                   output = original;
482                   output.writeRawBytes(buffer);
483                }
484             } else {
485                output.writeRawBytes(buffer);
486             }
487          }
488    
489          public int serializedSizeFramed() {
490             int t = serializedSizeUnframed();
491             return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t;
492          }
493    
494          public int serializedSizeUnframed() {
495             if (buffer != null) {
496                return buffer.length;
497             }
498             if (size != -1)
499                return size;
500    
501             size = 0;
502             size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(1, getKey());
503             if (hasBindingKind()) {
504                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(2, getBindingKind());
505             }
506             if (hasBindingData()) {
507                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(3, getBindingData());
508             }
509             return size;
510          }
511    
512          public boolean equals(Object obj) {
513             if( obj==this )
514                return true;
515             
516             if( obj==null || obj.getClass()!=Buffer.class )
517                return false;
518             
519             return equals((Buffer)obj);
520          }
521          
522          public boolean equals(Buffer obj) {
523             return toUnframedBuffer().equals(obj.toUnframedBuffer());
524          }
525          
526          public int hashCode() {
527             if( hashCode==0 ) {
528             hashCode=2000715872 ^ toUnframedBuffer().hashCode();
529             }
530             return hashCode;
531          }
532          
533          public boolean frozen() {
534             return true;
535          }
536       }
537    
538    }
539