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