001    //
002    // Generated by protoc, do not edit by hand.
003    //
004    package org.apache.activemq.protobuf;
005    
006    public class DeferredUnmarshal {
007    
008       static public final class Foo extends FooBase<Foo> {
009    
010          public java.util.ArrayList<String> missingFields() {
011             java.util.ArrayList<String> missingFields = super.missingFields();
012             return missingFields;
013          }
014    
015          public void clear() {
016             super.clear();
017             clearField1();
018             clearField2();
019          }
020    
021          public Foo clone() {
022             return new Foo().mergeFrom(this);
023          }
024    
025          public Foo mergeFrom(Foo other) {
026             if (other.hasField1()) {
027                setField1(other.getField1());
028             }
029             if (other.hasField2()) {
030                setField2(other.getField2());
031             }
032             return this;
033          }
034    
035          public int serializedSizeUnframed() {
036             if (encodedForm != null) {
037                return encodedForm.length;
038             }
039             if (memoizedSerializedSize != -1)
040                return memoizedSerializedSize;
041    
042             int size = 0;
043             if (hasField1()) {
044                size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(1, getField1());
045             }
046             if (hasField2()) {
047                size += org.apache.activemq.protobuf.CodedOutputStream.computeInt64Size(2, getField2());
048             }
049             memoizedSerializedSize = size;
050             return size;
051          }
052    
053          public Foo mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
054             while (true) {
055                int tag = input.readTag();
056                if ((tag & 0x07) == 4) {
057                   return this;
058                }
059                switch (tag) {
060                case 0:
061                   return this;
062                default: {
063                   break;
064                }
065                case 8:
066                   setField1(input.readInt32());
067                   break;
068                case 16:
069                   setField2(input.readInt64());
070                   break;
071                }
072             }
073          }
074          public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
075             if (encodedForm == null) {
076                int size = serializedSizeUnframed();
077                encodedForm = output.getNextBuffer(size);
078                org.apache.activemq.protobuf.CodedOutputStream original=null;
079                if( encodedForm == null ) {
080                   encodedForm = new org.apache.activemq.protobuf.Buffer(new byte[size]);
081                   original = output;
082                   output = new org.apache.activemq.protobuf.CodedOutputStream(encodedForm);
083                }
084                if (hasField1()) {
085                   output.writeInt32(1, getField1());
086                }
087                if (hasField2()) {
088                   output.writeInt64(2, getField2());
089                }
090                if( original !=null ) {
091                   output.checkNoSpaceLeft();
092                   output = original;
093                   output.writeRawBytes(encodedForm);
094                }
095             } else {
096                output.writeRawBytes(encodedForm);
097             }
098          }
099    
100          public static Foo parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
101             return new Foo().mergeUnframed(data);
102          }
103    
104          public static Foo parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
105             return new Foo().mergeUnframed(data);
106          }
107    
108          public static Foo parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
109             return new Foo().mergeUnframed(data);
110          }
111    
112          public static Foo parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
113             return new Foo().mergeUnframed(data);
114          }
115    
116          public static Foo parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
117             return new Foo().mergeFramed(data);
118          }
119    
120          public static Foo parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
121             return new Foo().mergeFramed(data);
122          }
123    
124          public static Foo parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
125             return new Foo().mergeFramed(data);
126          }
127    
128          public static Foo parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
129             return new Foo().mergeFramed(data);
130          }
131    
132          public String toString() {
133             return toString(new java.lang.StringBuilder(), "").toString();
134          }
135    
136          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
137             load();
138             if(  hasField1() ) {
139                sb.append(prefix+"field1: ");
140                sb.append(getField1());
141                sb.append("\n");
142             }
143             if(  hasField2() ) {
144                sb.append(prefix+"field2: ");
145                sb.append(getField2());
146                sb.append("\n");
147             }
148             return sb;
149          }
150    
151          public boolean equals(Object obj) {
152             if( obj==this )
153                return true;
154             
155             if( obj==null || obj.getClass()!=Foo.class )
156                return false;
157             
158             return equals((Foo)obj);
159          }
160          
161          public boolean equals(Foo obj) {
162             return toUnframedBuffer().equals(obj.toUnframedBuffer());
163          }
164          
165          public int hashCode() {
166             return 70822 ^ toUnframedBuffer().hashCode();
167          }
168          
169       }
170    
171       static abstract class FooBase<T> extends org.apache.activemq.protobuf.DeferredDecodeMessage<T> {
172    
173          // optional int32 field1 = 1;
174          private int f_field1 = 0;
175          private boolean b_field1;
176    
177          public boolean hasField1() {
178             load();
179             return this.b_field1;
180          }
181    
182          public int getField1() {
183             load();
184             return this.f_field1;
185          }
186    
187          public T setField1(int field1) {
188             loadAndClear();
189             this.b_field1 = true;
190             this.f_field1 = field1;
191             return (T)this;
192          }
193    
194          public void clearField1() {
195             loadAndClear();
196             this.b_field1 = false;
197             this.f_field1 = 0;
198          }
199    
200          // optional int64 field2 = 2;
201          private long f_field2 = 0;
202          private boolean b_field2;
203    
204          public boolean hasField2() {
205             load();
206             return this.b_field2;
207          }
208    
209          public long getField2() {
210             load();
211             return this.f_field2;
212          }
213    
214          public T setField2(long field2) {
215             loadAndClear();
216             this.b_field2 = true;
217             this.f_field2 = field2;
218             return (T)this;
219          }
220    
221          public void clearField2() {
222             loadAndClear();
223             this.b_field2 = false;
224             this.f_field2 = 0;
225          }
226    
227       }
228    
229    
230       static public final class Bar extends BarBase<Bar> {
231    
232          public java.util.ArrayList<String> missingFields() {
233             java.util.ArrayList<String> missingFields = super.missingFields();
234             return missingFields;
235          }
236    
237          public void clear() {
238             super.clear();
239             clearField1();
240             clearField2();
241             clearField3();
242          }
243    
244          public Bar clone() {
245             return new Bar().mergeFrom(this);
246          }
247    
248          public Bar mergeFrom(Bar other) {
249             if (other.hasField1()) {
250                setField1(other.getField1());
251             }
252             if (other.hasField2()) {
253                setField2(other.getField2());
254             }
255             if (other.hasField3()) {
256                if (hasField3()) {
257                   getField3().mergeFrom(other.getField3());
258                } else {
259                   setField3(other.getField3().clone());
260                }
261             }
262             return this;
263          }
264    
265          public int serializedSizeUnframed() {
266             if (encodedForm != null) {
267                return encodedForm.length;
268             }
269             if (memoizedSerializedSize != -1)
270                return memoizedSerializedSize;
271    
272             int size = 0;
273             if (hasField1()) {
274                size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(1, getField1());
275             }
276             if (hasField2()) {
277                size += org.apache.activemq.protobuf.CodedOutputStream.computeInt64Size(2, getField2());
278             }
279             if (hasField3()) {
280                size += computeMessageSize(3, getField3());
281             }
282             memoizedSerializedSize = size;
283             return size;
284          }
285    
286          public Bar mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
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                   setField1(input.readInt32());
300                   break;
301                case 16:
302                   setField2(input.readInt64());
303                   break;
304                case 26:
305                   if (hasField3()) {
306                      getField3().mergeFramed(input);
307                   } else {
308                      setField3(new Foo().mergeFramed(input));
309                   }
310                   break;
311                }
312             }
313          }
314          public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
315             if (encodedForm == null) {
316                int size = serializedSizeUnframed();
317                encodedForm = output.getNextBuffer(size);
318                org.apache.activemq.protobuf.CodedOutputStream original=null;
319                if( encodedForm == null ) {
320                   encodedForm = new org.apache.activemq.protobuf.Buffer(new byte[size]);
321                   original = output;
322                   output = new org.apache.activemq.protobuf.CodedOutputStream(encodedForm);
323                }
324                if (hasField1()) {
325                   output.writeInt32(1, getField1());
326                }
327                if (hasField2()) {
328                   output.writeInt64(2, getField2());
329                }
330                if (hasField3()) {
331                   writeMessage(output, 3, getField3());
332                }
333                if( original !=null ) {
334                   output.checkNoSpaceLeft();
335                   output = original;
336                   output.writeRawBytes(encodedForm);
337                }
338             } else {
339                output.writeRawBytes(encodedForm);
340             }
341          }
342    
343          public static Bar parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
344             return new Bar().mergeUnframed(data);
345          }
346    
347          public static Bar parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
348             return new Bar().mergeUnframed(data);
349          }
350    
351          public static Bar parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
352             return new Bar().mergeUnframed(data);
353          }
354    
355          public static Bar parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
356             return new Bar().mergeUnframed(data);
357          }
358    
359          public static Bar parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
360             return new Bar().mergeFramed(data);
361          }
362    
363          public static Bar parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
364             return new Bar().mergeFramed(data);
365          }
366    
367          public static Bar parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
368             return new Bar().mergeFramed(data);
369          }
370    
371          public static Bar parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
372             return new Bar().mergeFramed(data);
373          }
374    
375          public String toString() {
376             return toString(new java.lang.StringBuilder(), "").toString();
377          }
378    
379          public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
380             load();
381             if(  hasField1() ) {
382                sb.append(prefix+"field1: ");
383                sb.append(getField1());
384                sb.append("\n");
385             }
386             if(  hasField2() ) {
387                sb.append(prefix+"field2: ");
388                sb.append(getField2());
389                sb.append("\n");
390             }
391             if(  hasField3() ) {
392                sb.append(prefix+"field3 {\n");
393                getField3().toString(sb, prefix+"  ");
394                sb.append(prefix+"}\n");
395             }
396             return sb;
397          }
398    
399          public boolean equals(Object obj) {
400             if( obj==this )
401                return true;
402             
403             if( obj==null || obj.getClass()!=Bar.class )
404                return false;
405             
406             return equals((Bar)obj);
407          }
408          
409          public boolean equals(Bar obj) {
410             return toUnframedBuffer().equals(obj.toUnframedBuffer());
411          }
412          
413          public int hashCode() {
414             return 66547 ^ toUnframedBuffer().hashCode();
415          }
416          
417       }
418    
419       static abstract class BarBase<T> extends FooBase<T> {
420    
421          // optional Foo field3 = 3;
422          private Foo f_field3 = null;
423    
424          public boolean hasField3() {
425             load();
426             return this.f_field3!=null;
427          }
428    
429          public Foo getField3() {
430             load();
431             if( this.f_field3 == null ) {
432                this.f_field3 = new Foo();
433             }
434             return this.f_field3;
435          }
436    
437          public T setField3(Foo field3) {
438             loadAndClear();
439             this.f_field3 = field3;
440             return (T)this;
441          }
442    
443          public void clearField3() {
444             loadAndClear();
445             this.f_field3 = null;
446          }
447    
448       }
449    
450    }