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 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                   break;
200                }
201                case 10:
202                   setKey(input.readBytes());
203                   break;
204                case 18:
205                   setValue(input.readBytes());
206                   break;
207                }
208             }
209          }
210          public boolean equals(Object obj) {
211             if( obj==this )
212                return true;
213             
214             if( obj==null || obj.getClass()!=Bean.class )
215                return false;
216             
217             return equals((Bean)obj);
218          }
219          
220          public boolean equals(Bean obj) {
221             if (hasKey() ^ obj.hasKey() ) 
222                return false;
223             if (hasKey() && ( !getKey().equals(obj.getKey()) ))
224                return false;
225             if (hasValue() ^ obj.hasValue() ) 
226                return false;
227             if (hasValue() && ( !getValue().equals(obj.getValue()) ))
228                return false;
229             return true;
230          }
231          
232          public int hashCode() {
233             int rc=2066384;
234             if (hasKey()) {
235                rc ^= ( 75327^getKey().hashCode() );
236             }
237             if (hasValue()) {
238                rc ^= ( 82420049^getValue().hashCode() );
239             }
240             return rc;
241          }
242          
243          public Bean mergeFrom(Getter other) {
244             copyCheck();
245             if (other.hasKey()) {
246                setKey(other.getKey());
247             }
248             if (other.hasValue()) {
249                setValue(other.getValue());
250             }
251             return this;
252          }
253    
254          public void clear() {
255             clearKey();
256             clearValue();
257          }
258    
259          public void readExternal(java.io.DataInput in) throws java.io.IOException {
260             assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
261             bean = this;
262             frozen = null;
263             {
264                int size = in.readInt();
265                if( size>=0 ) {
266                   byte b[] = new byte[size];
267                   in.readFully(b);
268                   f_key = new org.fusesource.hawtbuf.Buffer(b);
269                } else {
270                   f_key = null;
271                }
272             }
273             {
274                int size = in.readInt();
275                if( size>=0 ) {
276                   byte b[] = new byte[size];
277                   in.readFully(b);
278                   f_value = new org.fusesource.hawtbuf.Buffer(b);
279                } else {
280                   f_value = null;
281                }
282             }
283          }
284    
285          public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
286             if( bean.f_key!=null ) {
287                out.writeInt(bean.f_key.getLength());
288                out.write(bean.f_key.getData(), bean.f_key.getOffset(), bean.f_key.getLength());
289             } else {
290                out.writeInt(-1);
291             }
292             if( bean.f_value!=null ) {
293                out.writeInt(bean.f_value.getLength());
294                out.write(bean.f_value.getData(), bean.f_value.getOffset(), bean.f_value.getLength());
295             } else {
296                out.writeInt(-1);
297             }
298          }
299    
300       }
301    
302       static public final class Buffer implements org.fusesource.hawtbuf.proto.MessageBuffer<MapEntryPB.Bean, MapEntryPB.Buffer>, Getter {
303    
304          private Bean bean;
305          private org.fusesource.hawtbuf.Buffer buffer;
306          private int size=-1;
307          private int hashCode;
308    
309          private Buffer(org.fusesource.hawtbuf.Buffer buffer) {
310             this.buffer = buffer;
311          }
312    
313          private Buffer(Bean bean) {
314             this.bean = bean;
315          }
316    
317          public Bean copy() {
318             return bean().copy();
319          }
320    
321          public Buffer freeze() {
322             return this;
323          }
324    
325          private Bean bean() {
326             if (bean == null) {
327                try {
328                   bean = new Bean().mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(buffer));
329                   bean.frozen=this;
330                } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
331                   throw new RuntimeException(e);
332                } catch (java.io.IOException e) {
333                   throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
334                }
335             }
336             return bean;
337          }
338    
339          public String toString() {
340             return bean().toString();
341          }
342    
343          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
344             return bean().toString(sb, prefix);
345          }
346    
347          // required bytes key = 1;
348          public boolean hasKey() {
349             return bean().hasKey();
350          }
351    
352          public org.fusesource.hawtbuf.Buffer getKey() {
353             return bean().getKey();
354          }
355    
356          // optional bytes value = 2;
357          public boolean hasValue() {
358             return bean().hasValue();
359          }
360    
361          public org.fusesource.hawtbuf.Buffer getValue() {
362             return bean().getValue();
363          }
364    
365          public org.fusesource.hawtbuf.Buffer toUnframedBuffer() {
366             if( buffer !=null ) {
367                return buffer;
368             }
369             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toUnframedBuffer(this);
370          }
371    
372          public org.fusesource.hawtbuf.Buffer toFramedBuffer() {
373             return org.fusesource.hawtbuf.proto.MessageBufferSupport.toFramedBuffer(this);
374          }
375    
376          public byte[] toUnframedByteArray() {
377             return toUnframedBuffer().toByteArray();
378          }
379    
380          public byte[] toFramedByteArray() {
381             return toFramedBuffer().toByteArray();
382          }
383    
384          public void writeFramed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
385             output.writeRawVarint32(serializedSizeUnframed());
386             writeUnframed(output);
387          }
388    
389          public void writeFramed(java.io.OutputStream output) throws java.io.IOException {
390             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
391             writeFramed(codedOutput);
392             codedOutput.flush();
393          }
394    
395          public void writeUnframed(java.io.OutputStream output) throws java.io.IOException {
396             org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
397             writeUnframed(codedOutput);
398             codedOutput.flush();
399          }
400    
401          public void writeUnframed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
402             if (buffer == null) {
403                int size = serializedSizeUnframed();
404                buffer = output.getNextBuffer(size);
405                org.fusesource.hawtbuf.proto.CodedOutputStream original=null;
406                if( buffer == null ) {
407                   buffer = new org.fusesource.hawtbuf.Buffer(new byte[size]);
408                   original = output;
409                   output = new org.fusesource.hawtbuf.proto.CodedOutputStream(buffer);
410                }
411                output.writeBytes(1, bean.getKey());
412                if (bean.hasValue()) {
413                   output.writeBytes(2, bean.getValue());
414                }
415                if( original !=null ) {
416                   output.checkNoSpaceLeft();
417                   output = original;
418                   output.writeRawBytes(buffer);
419                }
420             } else {
421                output.writeRawBytes(buffer);
422             }
423          }
424    
425          public int serializedSizeFramed() {
426             int t = serializedSizeUnframed();
427             return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t;
428          }
429    
430          public int serializedSizeUnframed() {
431             if (buffer != null) {
432                return buffer.length;
433             }
434             if (size != -1)
435                return size;
436    
437             size = 0;
438             size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(1, getKey());
439             if (hasValue()) {
440                size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(2, getValue());
441             }
442             return size;
443          }
444    
445          public boolean equals(Object obj) {
446             if( obj==this )
447                return true;
448             
449             if( obj==null || obj.getClass()!=Buffer.class )
450                return false;
451             
452             return equals((Buffer)obj);
453          }
454          
455          public boolean equals(Buffer obj) {
456             return toUnframedBuffer().equals(obj.toUnframedBuffer());
457          }
458          
459          public int hashCode() {
460             if( hashCode==0 ) {
461             hashCode=2000715872 ^ toUnframedBuffer().hashCode();
462             }
463             return hashCode;
464          }
465          
466          public boolean frozen() {
467             return true;
468          }
469       }
470    
471    }
472