001//
002// Generated by protoc, do not edit by hand.
003//
004package org.apache.activemq.store.kahadb.data;
005
006
007public final class KahaPrepareCommand extends KahaPrepareCommandBase<KahaPrepareCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaPrepareCommand> {
008
009   public java.util.ArrayList<String> missingFields() {
010      java.util.ArrayList<String> missingFields = super.missingFields();
011      if(  !hasTransactionInfo() ) {
012         missingFields.add("transaction_info");
013      }
014      if( hasTransactionInfo() ) {
015         try {
016            getTransactionInfo().assertInitialized();
017         } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
018            missingFields.addAll(prefix(e.getMissingFields(),"transaction_info."));
019         }
020      }
021      return missingFields;
022   }
023
024   public void clear() {
025      super.clear();
026      clearTransactionInfo();
027   }
028
029   public KahaPrepareCommand clone() {
030      return new KahaPrepareCommand().mergeFrom(this);
031   }
032
033   public KahaPrepareCommand mergeFrom(KahaPrepareCommand other) {
034      if (other.hasTransactionInfo()) {
035         if (hasTransactionInfo()) {
036            getTransactionInfo().mergeFrom(other.getTransactionInfo());
037         } else {
038            setTransactionInfo(other.getTransactionInfo().clone());
039         }
040      }
041      return this;
042   }
043
044   public int serializedSizeUnframed() {
045      if (memoizedSerializedSize != -1)
046         return memoizedSerializedSize;
047
048      int size = 0;
049      if (hasTransactionInfo()) {
050         size += computeMessageSize(1, getTransactionInfo());
051      }
052      memoizedSerializedSize = size;
053      return size;
054   }
055
056   public KahaPrepareCommand mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
057      while (true) {
058         int tag = input.readTag();
059         if ((tag & 0x07) == 4) {
060            return this;
061         }
062         switch (tag) {
063         case 0:
064            return this;
065         default: {
066            break;
067         }
068         case 10:
069            if (hasTransactionInfo()) {
070               getTransactionInfo().mergeFramed(input);
071            } else {
072               setTransactionInfo(new KahaTransactionInfo().mergeFramed(input));
073            }
074            break;
075         }
076      }
077   }
078   public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
079      if (hasTransactionInfo()) {
080         writeMessage(output, 1, getTransactionInfo());
081      }
082   }
083
084   public static KahaPrepareCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
085      return new KahaPrepareCommand().mergeUnframed(data).checktInitialized();
086   }
087
088   public static KahaPrepareCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
089      return new KahaPrepareCommand().mergeUnframed(data).checktInitialized();
090   }
091
092   public static KahaPrepareCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
093      return new KahaPrepareCommand().mergeUnframed(data).checktInitialized();
094   }
095
096   public static KahaPrepareCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
097      return new KahaPrepareCommand().mergeUnframed(data).checktInitialized();
098   }
099
100   public static KahaPrepareCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
101      return new KahaPrepareCommand().mergeFramed(data).checktInitialized();
102   }
103
104   public static KahaPrepareCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
105      return new KahaPrepareCommand().mergeFramed(data).checktInitialized();
106   }
107
108   public static KahaPrepareCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
109      return new KahaPrepareCommand().mergeFramed(data).checktInitialized();
110   }
111
112   public static KahaPrepareCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
113      return new KahaPrepareCommand().mergeFramed(data).checktInitialized();
114   }
115
116   public String toString() {
117      return toString(new java.lang.StringBuilder(), "").toString();
118   }
119
120   public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
121      if(  hasTransactionInfo() ) {
122         sb.append(prefix+"transaction_info {\n");
123         getTransactionInfo().toString(sb, prefix+"  ");
124         sb.append(prefix+"}\n");
125      }
126      return sb;
127   }
128
129   public void visit(org.apache.activemq.store.kahadb.Visitor visitor) throws java.io.IOException {
130      visitor.visit(this);
131   }
132
133   public KahaEntryType type() {
134      return KahaEntryType.KAHA_PREPARE_COMMAND;
135   }
136
137   public boolean equals(Object obj) {
138      if( obj==this )
139         return true;
140      
141      if( obj==null || obj.getClass()!=KahaPrepareCommand.class )
142         return false;
143      
144      return equals((KahaPrepareCommand)obj);
145   }
146   
147   public boolean equals(KahaPrepareCommand obj) {
148      if (hasTransactionInfo() ^ obj.hasTransactionInfo() ) 
149         return false;
150      if (hasTransactionInfo() && ( !getTransactionInfo().equals(obj.getTransactionInfo()) ))
151         return false;
152      return true;
153   }
154   
155   public int hashCode() {
156      int rc=-45182189;
157      if (hasTransactionInfo()) {
158         rc ^= ( 265667724^getTransactionInfo().hashCode() );
159      }
160      return rc;
161   }
162   
163}
164
165abstract class KahaPrepareCommandBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
166
167   // required KahaTransactionInfo transaction_info = 1;
168   private KahaTransactionInfo f_transactionInfo = null;
169
170   public boolean hasTransactionInfo() {
171      return this.f_transactionInfo!=null;
172   }
173
174   public KahaTransactionInfo getTransactionInfo() {
175      if( this.f_transactionInfo == null ) {
176         this.f_transactionInfo = new KahaTransactionInfo();
177      }
178      return this.f_transactionInfo;
179   }
180
181   public T setTransactionInfo(KahaTransactionInfo transactionInfo) {
182      loadAndClear();
183      this.f_transactionInfo = transactionInfo;
184      return (T)this;
185   }
186
187   public void clearTransactionInfo() {
188      loadAndClear();
189      this.f_transactionInfo = null;
190   }
191
192}
193