001    //
002    // Generated by protoc, do not edit by hand.
003    //
004    package org.apache.activemq.leveldb.record;
005    
006    
007    public class EntryRecord implements org.fusesource.hawtbuf.proto.PBMessageFactory<EntryRecord.Bean, EntryRecord.Buffer> {
008    
009       public static final EntryRecord FACTORY = new EntryRecord();
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<EntryRecord.Bean, EntryRecord.Buffer> {
063    
064          // optional int64 collection_key = 1;
065          public boolean hasCollectionKey();
066          public long getCollectionKey();
067          // optional bytes entry_key = 2;
068          public boolean hasEntryKey();
069          public org.fusesource.hawtbuf.Buffer getEntryKey();
070          // optional int64 value_location = 3;
071          public boolean hasValueLocation();
072          public long getValueLocation();
073          // optional int32 value_length = 4;
074          public boolean hasValueLength();
075          public int getValueLength();
076          // optional bytes value = 5;
077          public boolean hasValue();
078          public org.fusesource.hawtbuf.Buffer getValue();
079          // optional bytes meta = 6;
080          public boolean hasMeta();
081          public org.fusesource.hawtbuf.Buffer getMeta();
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_collectionKey = other.f_collectionKey;
131             this.b_collectionKey = other.b_collectionKey;
132             this.f_entryKey = other.f_entryKey;
133             this.f_valueLocation = other.f_valueLocation;
134             this.b_valueLocation = other.b_valueLocation;
135             this.f_valueLength = other.f_valueLength;
136             this.b_valueLength = other.b_valueLength;
137             this.f_value = other.f_value;
138             this.f_meta = other.f_meta;
139          }
140    
141          // optional int64 collection_key = 1;
142          private long f_collectionKey = 0;
143          private boolean b_collectionKey;
144    
145          public boolean hasCollectionKey() {
146             return bean.b_collectionKey;
147          }
148    
149          public long getCollectionKey() {
150             return bean.f_collectionKey;
151          }
152    
153          public Bean setCollectionKey(long collectionKey) {
154             copyCheck();
155             this.b_collectionKey = true;
156             this.f_collectionKey = collectionKey;
157             return this;
158          }
159    
160          public void clearCollectionKey() {
161             copyCheck();
162             this.b_collectionKey = false;
163             this.f_collectionKey = 0;
164          }
165    
166          // optional bytes entry_key = 2;
167          private org.fusesource.hawtbuf.Buffer f_entryKey = null;
168    
169          public boolean hasEntryKey() {
170             return bean.f_entryKey!=null;
171          }
172    
173          public org.fusesource.hawtbuf.Buffer getEntryKey() {
174             return bean.f_entryKey;
175          }
176    
177          public Bean setEntryKey(org.fusesource.hawtbuf.Buffer entryKey) {
178             copyCheck();
179             this.f_entryKey = entryKey;
180             return this;
181          }
182    
183          public void clearEntryKey() {
184             copyCheck();
185             this.f_entryKey = null;
186          }
187    
188          // optional int64 value_location = 3;
189          private long f_valueLocation = 0;
190          private boolean b_valueLocation;
191    
192          public boolean hasValueLocation() {
193             return bean.b_valueLocation;
194          }
195    
196          public long getValueLocation() {
197             return bean.f_valueLocation;
198          }
199    
200          public Bean setValueLocation(long valueLocation) {
201             copyCheck();
202             this.b_valueLocation = true;
203             this.f_valueLocation = valueLocation;
204             return this;
205          }
206    
207          public void clearValueLocation() {
208             copyCheck();
209             this.b_valueLocation = false;
210             this.f_valueLocation = 0;
211          }
212    
213          // optional int32 value_length = 4;
214          private int f_valueLength = 0;
215          private boolean b_valueLength;
216    
217          public boolean hasValueLength() {
218             return bean.b_valueLength;
219          }
220    
221          public int getValueLength() {
222             return bean.f_valueLength;
223          }
224    
225          public Bean setValueLength(int valueLength) {
226             copyCheck();
227             this.b_valueLength = true;
228             this.f_valueLength = valueLength;
229             return this;
230          }
231    
232          public void clearValueLength() {
233             copyCheck();
234             this.b_valueLength = false;
235             this.f_valueLength = 0;
236          }
237    
238          // optional bytes value = 5;
239          private org.fusesource.hawtbuf.Buffer f_value = null;
240    
241          public boolean hasValue() {
242             return bean.f_value!=null;
243          }
244    
245          public org.fusesource.hawtbuf.Buffer getValue() {
246             return bean.f_value;
247          }
248    
249          public Bean setValue(org.fusesource.hawtbuf.Buffer value) {
250             copyCheck();
251             this.f_value = value;
252             return this;
253          }
254    
255          public void clearValue() {
256             copyCheck();
257             this.f_value = null;
258          }
259    
260          // optional bytes meta = 6;
261          private org.fusesource.hawtbuf.Buffer f_meta = null;
262    
263          public boolean hasMeta() {
264             return bean.f_meta!=null;
265          }
266    
267          public org.fusesource.hawtbuf.Buffer getMeta() {
268             return bean.f_meta;
269          }
270    
271          public Bean setMeta(org.fusesource.hawtbuf.Buffer meta) {
272             copyCheck();
273             this.f_meta = meta;
274             return this;
275          }
276    
277          public void clearMeta() {
278             copyCheck();
279             this.f_meta = null;
280          }
281    
282          public String toString() {
283             return toString(new java.lang.StringBuilder(), "").toString();
284          }
285    
286          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
287             if(  hasCollectionKey() ) {
288                sb.append(prefix+"collection_key: ");
289                sb.append(getCollectionKey());
290                sb.append("\n");
291             }
292             if(  hasEntryKey() ) {
293                sb.append(prefix+"entry_key: ");
294                sb.append(getEntryKey());
295                sb.append("\n");
296             }
297             if(  hasValueLocation() ) {
298                sb.append(prefix+"value_location: ");
299                sb.append(getValueLocation());
300                sb.append("\n");
301             }
302             if(  hasValueLength() ) {
303                sb.append(prefix+"value_length: ");
304                sb.append(getValueLength());
305                sb.append("\n");
306             }
307             if(  hasValue() ) {
308                sb.append(prefix+"value: ");
309                sb.append(getValue());
310                sb.append("\n");
311             }
312             if(  hasMeta() ) {
313                sb.append(prefix+"meta: ");
314                sb.append(getMeta());
315                sb.append("\n");
316             }
317             return sb;
318          }
319    
320          public Bean mergeUnframed(java.io.InputStream input) throws java.io.IOException {
321             return mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(input));
322          }
323    
324          public Bean mergeUnframed(org.fusesource.hawtbuf.proto.CodedInputStream input) throws java.io.IOException {
325             copyCheck();
326             while (true) {
327                int tag = input.readTag();
328                if ((tag & 0x07) == 4) {
329                   return this;
330                }
331                switch (tag) {
332                case 0:
333                   return this;
334                default: {
335                   break;
336                }
337                case 8:
338                   setCollectionKey(input.readInt64());
339                   break;
340                case 18:
341                   setEntryKey(input.readBytes());
342                   break;
343                case 24:
344                   setValueLocation(input.readInt64());
345                   break;
346                case 32:
347                   setValueLength(input.readInt32());
348                   break;
349                case 42:
350                   setValue(input.readBytes());
351                   break;
352                case 50:
353                   setMeta(input.readBytes());
354                   break;
355                }
356             }
357          }
358          public boolean equals(Object obj) {
359             if( obj==this )
360                return true;
361             
362             if( obj==null || obj.getClass()!=Bean.class )
363                return false;
364             
365             return equals((Bean)obj);
366          }
367          
368          public boolean equals(Bean obj) {
369             if (hasCollectionKey() ^ obj.hasCollectionKey() ) 
370                return false;
371             if (hasCollectionKey() && ( getCollectionKey()!=obj.getCollectionKey() ))
372                return false;
373             if (hasEntryKey() ^ obj.hasEntryKey() ) 
374                return false;
375             if (hasEntryKey() && ( !getEntryKey().equals(obj.getEntryKey()) ))
376                return false;
377             if (hasValueLocation() ^ obj.hasValueLocation() ) 
378                return false;
379             if (hasValueLocation() && ( getValueLocation()!=obj.getValueLocation() ))
380                return false;
381             if (hasValueLength() ^ obj.hasValueLength() ) 
382                return false;
383             if (hasValueLength() && ( getValueLength()!=obj.getValueLength() ))
384                return false;
385             if (hasValue() ^ obj.hasValue() ) 
386                return false;
387             if (hasValue() && ( !getValue().equals(obj.getValue()) ))
388                return false;
389             if (hasMeta() ^ obj.hasMeta() ) 
390                return false;
391             if (hasMeta() && ( !getMeta().equals(obj.getMeta()) ))
392                return false;
393             return true;
394          }
395          
396          public int hashCode() {
397             int rc=2066384;
398             if (hasCollectionKey()) {
399                rc ^= ( -22299967^(new Long(getCollectionKey())).hashCode() );
400             }
401             if (hasEntryKey()) {
402                rc ^= ( -2029038419^getEntryKey().hashCode() );
403             }
404             if (hasValueLocation()) {
405                rc ^= ( 1955185702^(new Long(getValueLocation())).hashCode() );
406             }
407             if (hasValueLength()) {
408                rc ^= ( 28886935^getValueLength() );
409             }
410             if (hasValue()) {
411                rc ^= ( 82420049^getValue().hashCode() );
412             }
413             if (hasMeta()) {
414                rc ^= ( 2394661^getMeta().hashCode() );
415             }
416             return rc;
417          }
418          
419          public Bean mergeFrom(Getter other) {
420             copyCheck();
421             if (other.hasCollectionKey()) {
422                setCollectionKey(other.getCollectionKey());
423             }
424             if (other.hasEntryKey()) {
425                setEntryKey(other.getEntryKey());
426             }
427             if (other.hasValueLocation()) {
428                setValueLocation(other.getValueLocation());
429             }
430             if (other.hasValueLength()) {
431                setValueLength(other.getValueLength());
432             }
433             if (other.hasValue()) {
434                setValue(other.getValue());
435             }
436             if (other.hasMeta()) {
437                setMeta(other.getMeta());
438             }
439             return this;
440          }
441    
442          public void clear() {
443             clearCollectionKey();
444             clearEntryKey();
445             clearValueLocation();
446             clearValueLength();
447             clearValue();
448             clearMeta();
449          }
450    
451          public void readExternal(java.io.DataInput in) throws java.io.IOException {
452             assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
453             bean = this;
454             frozen = null;
455             f_collectionKey = in.readLong();
456             b_collectionKey = true;
457             {
458                int size = in.readInt();
459                if( size>=0 ) {
460                   byte b[] = new byte[size];
461                   in.readFully(b);
462                   f_entryKey = new org.fusesource.hawtbuf.Buffer(b);
463                } else {
464                   f_entryKey = null;
465                }
466             }
467             f_valueLocation = in.readLong();
468             b_valueLocation = true;
469             f_valueLength = in.readInt();
470             b_valueLength = true;
471             {
472                int size = in.readInt();
473                if( size>=0 ) {
474                   byte b[] = new byte[size];
475                   in.readFully(b);
476                   f_value = new org.fusesource.hawtbuf.Buffer(b);
477                } else {
478                   f_value = null;
479                }
480             }
481             {
482                int size = in.readInt();
483                if( size>=0 ) {
484                   byte b[] = new byte[size];
485                   in.readFully(b);
486                   f_meta = new org.fusesource.hawtbuf.Buffer(b);
487                } else {
488                   f_meta = null;
489                }
490             }
491          }
492    
493          public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
494             out.writeLong(bean.f_collectionKey);
495             if( bean.f_entryKey!=null ) {
496                out.writeInt(bean.f_entryKey.getLength());
497                out.write(bean.f_entryKey.getData(), bean.f_entryKey.getOffset(), bean.f_entryKey.getLength());
498             } else {
499                out.writeInt(-1);
500             }
501             out.writeLong(bean.f_valueLocation);
502             out.writeInt(bean.f_valueLength);
503             if( bean.f_value!=null ) {
504                out.writeInt(bean.f_value.getLength());
505                out.write(bean.f_value.getData(), bean.f_value.getOffset(), bean.f_value.getLength());
506             } else {
507                out.writeInt(-1);
508             }
509             if( bean.f_meta!=null ) {
510                out.writeInt(bean.f_meta.getLength());
511                out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.getLength());
512             } else {
513                out.writeInt(-1);
514             }
515          }
516    
517       }
518    
519       static public final class Buffer implements org.fusesource.hawtbuf.proto.MessageBuffer<EntryRecord.Bean, EntryRecord.Buffer>, Getter {
520    
521          private Bean bean;
522          private org.fusesource.hawtbuf.Buffer buffer;
523          private int size=-1;
524          private int hashCode;
525    
526          private Buffer(org.fusesource.hawtbuf.Buffer buffer) {
527             this.buffer = buffer;
528          }
529    
530          private Buffer(Bean bean) {
531             this.bean = bean;
532          }
533    
534          public Bean copy() {
535             return bean().copy();
536          }
537    
538          public Buffer freeze() {
539             return this;
540          }
541    
542          private Bean bean() {
543             if (bean == null) {
544                try {
545                   bean = new Bean().mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(buffer));
546                   bean.frozen=this;
547                } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
548                   throw new RuntimeException(e);
549                } catch (java.io.IOException e) {
550                   throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
551                }
552             }
553             return bean;
554          }
555    
556          public String toString() {
557             return bean().toString();
558          }
559    
560          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
561             return bean().toString(sb, prefix);
562          }
563    
564          // optional int64 collection_key = 1;
565          public boolean hasCollectionKey() {
566             return bean().hasCollectionKey();
567          }
568    
569          public long getCollectionKey() {
570             return bean().getCollectionKey();
571          }
572    
573          // optional bytes entry_key = 2;
574          public boolean hasEntryKey() {
575             return bean().hasEntryKey();
576          }
577    
578          public org.fusesource.hawtbuf.Buffer getEntryKey() {
579             return bean().getEntryKey();
580          }
581    
582          // optional int64 value_location = 3;
583          public boolean hasValueLocation() {
584             return bean().hasValueLocation();
585          }
586    
587          public long getValueLocation() {
588             return bean().getValueLocation();
589          }
590    
591          // optional int32 value_length = 4;
592          public boolean hasValueLength() {
593             return bean().hasValueLength();
594          }
595    
596          public int getValueLength() {
597             return bean().getValueLength();
598          }
599    
600          // optional bytes value = 5;
601          public boolean hasValue() {
602             return bean().hasValue();
603          }
604    
605          public org.fusesource.hawtbuf.Buffer getValue() {
606             return bean().getValue();
607          }
608    
609          // optional bytes meta = 6;
610          public boolean hasMeta() {
611             return bean().hasMeta();
612          }
613    
614          public org.fusesource.hawtbuf.Buffer getMeta() {
615             return bean().getMeta();
616          }
617    
618          public org.fusesource.hawtbuf.Buffer toUnframedBuffer() {
619             if( buffer !=null ) {
620                return buffer;
621             }
622             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toUnframedBuffer(this);
623          }
624    
625          public org.fusesource.hawtbuf.Buffer toFramedBuffer() {
626             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toFramedBuffer(this);
627          }
628    
629          public byte[] toUnframedByteArray() {
630             return toUnframedBuffer().toByteArray();
631          }
632    
633          public byte[] toFramedByteArray() {
634             return toFramedBuffer().toByteArray();
635          }
636    
637          public void writeFramed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
638             output.writeRawVarint32(serializedSizeUnframed());
639             writeUnframed(output);
640          }
641    
642          public void writeFramed(java.io.OutputStream output) throws java.io.IOException {
643             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
644             writeFramed(codedOutput);
645             codedOutput.flush();
646          }
647    
648          public void writeUnframed(java.io.OutputStream output) throws java.io.IOException {
649             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
650             writeUnframed(codedOutput);
651             codedOutput.flush();
652          }
653    
654          public void writeUnframed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
655             if (buffer == null) {
656                int size = serializedSizeUnframed();
657                buffer = output.getNextBuffer(size);
658                org.fusesource.hawtbuf.proto.CodedOutputStream original=null;
659                if( buffer == null ) {
660                   buffer = new org.fusesource.hawtbuf.Buffer(new byte[size]);
661                   original = output;
662                   output = new org.fusesource.hawtbuf.proto.CodedOutputStream(buffer);
663                }
664                if (bean.hasCollectionKey()) {
665                   output.writeInt64(1, bean.getCollectionKey());
666                }
667                if (bean.hasEntryKey()) {
668                   output.writeBytes(2, bean.getEntryKey());
669                }
670                if (bean.hasValueLocation()) {
671                   output.writeInt64(3, bean.getValueLocation());
672                }
673                if (bean.hasValueLength()) {
674                   output.writeInt32(4, bean.getValueLength());
675                }
676                if (bean.hasValue()) {
677                   output.writeBytes(5, bean.getValue());
678                }
679                if (bean.hasMeta()) {
680                   output.writeBytes(6, bean.getMeta());
681                }
682                if( original !=null ) {
683                   output.checkNoSpaceLeft();
684                   output = original;
685                   output.writeRawBytes(buffer);
686                }
687             } else {
688                output.writeRawBytes(buffer);
689             }
690          }
691    
692          public int serializedSizeFramed() {
693             int t = serializedSizeUnframed();
694             return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t;
695          }
696    
697          public int serializedSizeUnframed() {
698             if (buffer != null) {
699                return buffer.length;
700             }
701             if (size != -1)
702                return size;
703    
704             size = 0;
705             if (hasCollectionKey()) {
706                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(1, getCollectionKey());
707             }
708             if (hasEntryKey()) {
709                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(2, getEntryKey());
710             }
711             if (hasValueLocation()) {
712                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(3, getValueLocation());
713             }
714             if (hasValueLength()) {
715                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt32Size(4, getValueLength());
716             }
717             if (hasValue()) {
718                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(5, getValue());
719             }
720             if (hasMeta()) {
721                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(6, getMeta());
722             }
723             return size;
724          }
725    
726          public boolean equals(Object obj) {
727             if( obj==this )
728                return true;
729             
730             if( obj==null || obj.getClass()!=Buffer.class )
731                return false;
732             
733             return equals((Buffer)obj);
734          }
735          
736          public boolean equals(Buffer obj) {
737             return toUnframedBuffer().equals(obj.toUnframedBuffer());
738          }
739          
740          public int hashCode() {
741             if( hashCode==0 ) {
742             hashCode=2000715872 ^ toUnframedBuffer().hashCode();
743             }
744             return hashCode;
745          }
746          
747          public boolean frozen() {
748             return true;
749          }
750       }
751    
752    }
753