001    //
002    // Generated by protoc, do not edit by hand.
003    //
004    package org.apache.activemq.store.kahadb.data;
005    
006    
007    public final class KahaAddMessageCommand extends KahaAddMessageCommandBase<KahaAddMessageCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaAddMessageCommand> {
008    
009       public java.util.ArrayList<String> missingFields() {
010          java.util.ArrayList<String> missingFields = super.missingFields();
011          if(  !hasDestination() ) {
012             missingFields.add("destination");
013          }
014          if(  !hasMessageId() ) {
015             missingFields.add("messageId");
016          }
017          if(  !hasMessage() ) {
018             missingFields.add("message");
019          }
020          if( hasTransactionInfo() ) {
021             try {
022                getTransactionInfo().assertInitialized();
023             } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
024                missingFields.addAll(prefix(e.getMissingFields(),"transaction_info."));
025             }
026          }
027          if( hasDestination() ) {
028             try {
029                getDestination().assertInitialized();
030             } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
031                missingFields.addAll(prefix(e.getMissingFields(),"destination."));
032             }
033          }
034          return missingFields;
035       }
036    
037       public void clear() {
038          super.clear();
039          clearTransactionInfo();
040          clearDestination();
041          clearMessageId();
042          clearMessage();
043          clearPriority();
044          clearPrioritySupported();
045       }
046    
047       public KahaAddMessageCommand clone() {
048          return new KahaAddMessageCommand().mergeFrom(this);
049       }
050    
051       public KahaAddMessageCommand mergeFrom(KahaAddMessageCommand other) {
052          if (other.hasTransactionInfo()) {
053             if (hasTransactionInfo()) {
054                getTransactionInfo().mergeFrom(other.getTransactionInfo());
055             } else {
056                setTransactionInfo(other.getTransactionInfo().clone());
057             }
058          }
059          if (other.hasDestination()) {
060             if (hasDestination()) {
061                getDestination().mergeFrom(other.getDestination());
062             } else {
063                setDestination(other.getDestination().clone());
064             }
065          }
066          if (other.hasMessageId()) {
067             setMessageId(other.getMessageId());
068          }
069          if (other.hasMessage()) {
070             setMessage(other.getMessage());
071          }
072          if (other.hasPriority()) {
073             setPriority(other.getPriority());
074          }
075          if (other.hasPrioritySupported()) {
076             setPrioritySupported(other.getPrioritySupported());
077          }
078          return this;
079       }
080    
081       public int serializedSizeUnframed() {
082          if (memoizedSerializedSize != -1)
083             return memoizedSerializedSize;
084    
085          int size = 0;
086          if (hasTransactionInfo()) {
087             size += computeMessageSize(1, getTransactionInfo());
088          }
089          if (hasDestination()) {
090             size += computeMessageSize(2, getDestination());
091          }
092          if (hasMessageId()) {
093             size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize(3, getMessageId());
094          }
095          if (hasMessage()) {
096             size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize(4, getMessage());
097          }
098          if (hasPriority()) {
099             size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(5, getPriority());
100          }
101          if (hasPrioritySupported()) {
102             size += org.apache.activemq.protobuf.CodedOutputStream.computeBoolSize(6, getPrioritySupported());
103          }
104          memoizedSerializedSize = size;
105          return size;
106       }
107    
108       public KahaAddMessageCommand mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
109          while (true) {
110             int tag = input.readTag();
111             if ((tag & 0x07) == 4) {
112                return this;
113             }
114             switch (tag) {
115             case 0:
116                return this;
117             default: {
118                break;
119             }
120             case 10:
121                if (hasTransactionInfo()) {
122                   getTransactionInfo().mergeFramed(input);
123                } else {
124                   setTransactionInfo(new KahaTransactionInfo().mergeFramed(input));
125                }
126                break;
127             case 18:
128                if (hasDestination()) {
129                   getDestination().mergeFramed(input);
130                } else {
131                   setDestination(new KahaDestination().mergeFramed(input));
132                }
133                break;
134             case 26:
135                setMessageId(input.readString());
136                break;
137             case 34:
138                setMessage(input.readBytes());
139                break;
140             case 40:
141                setPriority(input.readInt32());
142                break;
143             case 48:
144                setPrioritySupported(input.readBool());
145                break;
146             }
147          }
148       }
149       public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
150          if (hasTransactionInfo()) {
151             writeMessage(output, 1, getTransactionInfo());
152          }
153          if (hasDestination()) {
154             writeMessage(output, 2, getDestination());
155          }
156          if (hasMessageId()) {
157             output.writeString(3, getMessageId());
158          }
159          if (hasMessage()) {
160             output.writeBytes(4, getMessage());
161          }
162          if (hasPriority()) {
163             output.writeInt32(5, getPriority());
164          }
165          if (hasPrioritySupported()) {
166             output.writeBool(6, getPrioritySupported());
167          }
168       }
169    
170       public static KahaAddMessageCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
171          return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
172       }
173    
174       public static KahaAddMessageCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
175          return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
176       }
177    
178       public static KahaAddMessageCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
179          return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
180       }
181    
182       public static KahaAddMessageCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
183          return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
184       }
185    
186       public static KahaAddMessageCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
187          return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
188       }
189    
190       public static KahaAddMessageCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
191          return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
192       }
193    
194       public static KahaAddMessageCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
195          return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
196       }
197    
198       public static KahaAddMessageCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
199          return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
200       }
201    
202       public String toString() {
203          return toString(new java.lang.StringBuilder(), "").toString();
204       }
205    
206       public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
207          if(  hasTransactionInfo() ) {
208             sb.append(prefix+"transaction_info {\n");
209             getTransactionInfo().toString(sb, prefix+"  ");
210             sb.append(prefix+"}\n");
211          }
212          if(  hasDestination() ) {
213             sb.append(prefix+"destination {\n");
214             getDestination().toString(sb, prefix+"  ");
215             sb.append(prefix+"}\n");
216          }
217          if(  hasMessageId() ) {
218             sb.append(prefix+"messageId: ");
219             sb.append(getMessageId());
220             sb.append("\n");
221          }
222          if(  hasMessage() ) {
223             sb.append(prefix+"message: ");
224             sb.append(getMessage());
225             sb.append("\n");
226          }
227          if(  hasPriority() ) {
228             sb.append(prefix+"priority: ");
229             sb.append(getPriority());
230             sb.append("\n");
231          }
232          if(  hasPrioritySupported() ) {
233             sb.append(prefix+"prioritySupported: ");
234             sb.append(getPrioritySupported());
235             sb.append("\n");
236          }
237          return sb;
238       }
239    
240       public void visit(org.apache.activemq.store.kahadb.Visitor visitor) throws java.io.IOException {
241          visitor.visit(this);
242       }
243    
244       public KahaEntryType type() {
245          return KahaEntryType.KAHA_ADD_MESSAGE_COMMAND;
246       }
247    
248       public boolean equals(Object obj) {
249          if( obj==this )
250             return true;
251          
252          if( obj==null || obj.getClass()!=KahaAddMessageCommand.class )
253             return false;
254          
255          return equals((KahaAddMessageCommand)obj);
256       }
257       
258       public boolean equals(KahaAddMessageCommand obj) {
259          if (hasTransactionInfo() ^ obj.hasTransactionInfo() ) 
260             return false;
261          if (hasTransactionInfo() && ( !getTransactionInfo().equals(obj.getTransactionInfo()) ))
262             return false;
263          if (hasDestination() ^ obj.hasDestination() ) 
264             return false;
265          if (hasDestination() && ( !getDestination().equals(obj.getDestination()) ))
266             return false;
267          if (hasMessageId() ^ obj.hasMessageId() ) 
268             return false;
269          if (hasMessageId() && ( !getMessageId().equals(obj.getMessageId()) ))
270             return false;
271          if (hasMessage() ^ obj.hasMessage() ) 
272             return false;
273          if (hasMessage() && ( !getMessage().equals(obj.getMessage()) ))
274             return false;
275          if (hasPriority() ^ obj.hasPriority() ) 
276             return false;
277          if (hasPriority() && ( getPriority()!=obj.getPriority() ))
278             return false;
279          if (hasPrioritySupported() ^ obj.hasPrioritySupported() ) 
280             return false;
281          if (hasPrioritySupported() && ( getPrioritySupported()!=obj.getPrioritySupported() ))
282             return false;
283          return true;
284       }
285       
286       public int hashCode() {
287          int rc=1601475350;
288          if (hasTransactionInfo()) {
289             rc ^= ( 265667724^getTransactionInfo().hashCode() );
290          }
291          if (hasDestination()) {
292             rc ^= ( 238021614^getDestination().hashCode() );
293          }
294          if (hasMessageId()) {
295             rc ^= ( 563954530^getMessageId().hashCode() );
296          }
297          if (hasMessage()) {
298             rc ^= ( -1675388953^getMessage().hashCode() );
299          }
300          if (hasPriority()) {
301             rc ^= ( -1100816956^getPriority() );
302          }
303          if (hasPrioritySupported()) {
304             rc ^= ( 889475914^ (getPrioritySupported()? 6:-6) );
305          }
306          return rc;
307       }
308       
309    }
310    
311    abstract class KahaAddMessageCommandBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
312    
313       // optional KahaTransactionInfo transaction_info = 1;
314       private KahaTransactionInfo f_transactionInfo = null;
315    
316       public boolean hasTransactionInfo() {
317          return this.f_transactionInfo!=null;
318       }
319    
320       public KahaTransactionInfo getTransactionInfo() {
321          if( this.f_transactionInfo == null ) {
322             this.f_transactionInfo = new KahaTransactionInfo();
323          }
324          return this.f_transactionInfo;
325       }
326    
327       public T setTransactionInfo(KahaTransactionInfo transactionInfo) {
328          loadAndClear();
329          this.f_transactionInfo = transactionInfo;
330          return (T)this;
331       }
332    
333       public void clearTransactionInfo() {
334          loadAndClear();
335          this.f_transactionInfo = null;
336       }
337    
338       // required KahaDestination destination = 2;
339       private KahaDestination f_destination = null;
340    
341       public boolean hasDestination() {
342          return this.f_destination!=null;
343       }
344    
345       public KahaDestination getDestination() {
346          if( this.f_destination == null ) {
347             this.f_destination = new KahaDestination();
348          }
349          return this.f_destination;
350       }
351    
352       public T setDestination(KahaDestination destination) {
353          loadAndClear();
354          this.f_destination = destination;
355          return (T)this;
356       }
357    
358       public void clearDestination() {
359          loadAndClear();
360          this.f_destination = null;
361       }
362    
363       // required string messageId = 3;
364       private java.lang.String f_messageId = null;
365       private boolean b_messageId;
366    
367       public boolean hasMessageId() {
368          return this.b_messageId;
369       }
370    
371       public java.lang.String getMessageId() {
372          return this.f_messageId;
373       }
374    
375       public T setMessageId(java.lang.String messageId) {
376          loadAndClear();
377          this.b_messageId = true;
378          this.f_messageId = messageId;
379          return (T)this;
380       }
381    
382       public void clearMessageId() {
383          loadAndClear();
384          this.b_messageId = false;
385          this.f_messageId = null;
386       }
387    
388       // required bytes message = 4;
389       private org.apache.activemq.protobuf.Buffer f_message = null;
390       private boolean b_message;
391    
392       public boolean hasMessage() {
393          return this.b_message;
394       }
395    
396       public org.apache.activemq.protobuf.Buffer getMessage() {
397          return this.f_message;
398       }
399    
400       public T setMessage(org.apache.activemq.protobuf.Buffer message) {
401          loadAndClear();
402          this.b_message = true;
403          this.f_message = message;
404          return (T)this;
405       }
406    
407       public void clearMessage() {
408          loadAndClear();
409          this.b_message = false;
410          this.f_message = null;
411       }
412    
413       // optional int32 priority = 5;
414       private int f_priority = 4;
415       private boolean b_priority;
416    
417       public boolean hasPriority() {
418          return this.b_priority;
419       }
420    
421       public int getPriority() {
422          return this.f_priority;
423       }
424    
425       public T setPriority(int priority) {
426          loadAndClear();
427          this.b_priority = true;
428          this.f_priority = priority;
429          return (T)this;
430       }
431    
432       public void clearPriority() {
433          loadAndClear();
434          this.b_priority = false;
435          this.f_priority = 4;
436       }
437    
438       // optional bool prioritySupported = 6;
439       private boolean f_prioritySupported = false;
440       private boolean b_prioritySupported;
441    
442       public boolean hasPrioritySupported() {
443          return this.b_prioritySupported;
444       }
445    
446       public boolean getPrioritySupported() {
447          return this.f_prioritySupported;
448       }
449    
450       public T setPrioritySupported(boolean prioritySupported) {
451          loadAndClear();
452          this.b_prioritySupported = true;
453          this.f_prioritySupported = prioritySupported;
454          return (T)this;
455       }
456    
457       public void clearPrioritySupported() {
458          loadAndClear();
459          this.b_prioritySupported = false;
460          this.f_prioritySupported = false;
461       }
462    
463    }
464