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 KahaLocalTransactionId extends KahaLocalTransactionIdBase<KahaLocalTransactionId> {
008    
009       public java.util.ArrayList<String> missingFields() {
010          java.util.ArrayList<String> missingFields = super.missingFields();
011          if(  !hasConnectionId() ) {
012             missingFields.add("connection_id");
013          }
014          if(  !hasTransactionId() ) {
015             missingFields.add("transaction_id");
016          }
017          return missingFields;
018       }
019    
020       public void clear() {
021          super.clear();
022          clearConnectionId();
023          clearTransactionId();
024       }
025    
026       public KahaLocalTransactionId clone() {
027          return new KahaLocalTransactionId().mergeFrom(this);
028       }
029    
030       public KahaLocalTransactionId mergeFrom(KahaLocalTransactionId other) {
031          if (other.hasConnectionId()) {
032             setConnectionId(other.getConnectionId());
033          }
034          if (other.hasTransactionId()) {
035             setTransactionId(other.getTransactionId());
036          }
037          return this;
038       }
039    
040       public int serializedSizeUnframed() {
041          if (memoizedSerializedSize != -1)
042             return memoizedSerializedSize;
043    
044          int size = 0;
045          if (hasConnectionId()) {
046             size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize(1, getConnectionId());
047          }
048          if (hasTransactionId()) {
049             size += org.apache.activemq.protobuf.CodedOutputStream.computeInt64Size(1, getTransactionId());
050          }
051          memoizedSerializedSize = size;
052          return size;
053       }
054    
055       public KahaLocalTransactionId mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
056          while (true) {
057             int tag = input.readTag();
058             if ((tag & 0x07) == 4) {
059                return this;
060             }
061             switch (tag) {
062             case 0:
063                return this;
064             default: {
065                break;
066             }
067             case 10:
068                setConnectionId(input.readString());
069                break;
070             case 8:
071                setTransactionId(input.readInt64());
072                break;
073             }
074          }
075       }
076       public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
077          if (hasConnectionId()) {
078             output.writeString(1, getConnectionId());
079          }
080          if (hasTransactionId()) {
081             output.writeInt64(1, getTransactionId());
082          }
083       }
084    
085       public static KahaLocalTransactionId parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
086          return new KahaLocalTransactionId().mergeUnframed(data).checktInitialized();
087       }
088    
089       public static KahaLocalTransactionId parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
090          return new KahaLocalTransactionId().mergeUnframed(data).checktInitialized();
091       }
092    
093       public static KahaLocalTransactionId parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
094          return new KahaLocalTransactionId().mergeUnframed(data).checktInitialized();
095       }
096    
097       public static KahaLocalTransactionId parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
098          return new KahaLocalTransactionId().mergeUnframed(data).checktInitialized();
099       }
100    
101       public static KahaLocalTransactionId parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
102          return new KahaLocalTransactionId().mergeFramed(data).checktInitialized();
103       }
104    
105       public static KahaLocalTransactionId parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
106          return new KahaLocalTransactionId().mergeFramed(data).checktInitialized();
107       }
108    
109       public static KahaLocalTransactionId parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
110          return new KahaLocalTransactionId().mergeFramed(data).checktInitialized();
111       }
112    
113       public static KahaLocalTransactionId parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
114          return new KahaLocalTransactionId().mergeFramed(data).checktInitialized();
115       }
116    
117       public String toString() {
118          return toString(new java.lang.StringBuilder(), "").toString();
119       }
120    
121       public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
122          if(  hasConnectionId() ) {
123             sb.append(prefix+"connection_id: ");
124             sb.append(getConnectionId());
125             sb.append("\n");
126          }
127          if(  hasTransactionId() ) {
128             sb.append(prefix+"transaction_id: ");
129             sb.append(getTransactionId());
130             sb.append("\n");
131          }
132          return sb;
133       }
134    
135       public boolean equals(Object obj) {
136          if( obj==this )
137             return true;
138          
139          if( obj==null || obj.getClass()!=KahaLocalTransactionId.class )
140             return false;
141          
142          return equals((KahaLocalTransactionId)obj);
143       }
144       
145       public boolean equals(KahaLocalTransactionId obj) {
146          if (hasConnectionId() ^ obj.hasConnectionId() ) 
147             return false;
148          if (hasConnectionId() && ( !getConnectionId().equals(obj.getConnectionId()) ))
149             return false;
150          if (hasTransactionId() ^ obj.hasTransactionId() ) 
151             return false;
152          if (hasTransactionId() && ( getTransactionId()!=obj.getTransactionId() ))
153             return false;
154          return true;
155       }
156       
157       public int hashCode() {
158          int rc=1725637181;
159          if (hasConnectionId()) {
160             rc ^= ( 2087427257^getConnectionId().hashCode() );
161          }
162          if (hasTransactionId()) {
163             rc ^= ( 1247202425^(new Long(getTransactionId())).hashCode() );
164          }
165          return rc;
166       }
167       
168    }
169    
170    abstract class KahaLocalTransactionIdBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
171    
172       // required string connection_id = 1;
173       private java.lang.String f_connectionId = null;
174       private boolean b_connectionId;
175    
176       public boolean hasConnectionId() {
177          return this.b_connectionId;
178       }
179    
180       public java.lang.String getConnectionId() {
181          return this.f_connectionId;
182       }
183    
184       public T setConnectionId(java.lang.String connectionId) {
185          loadAndClear();
186          this.b_connectionId = true;
187          this.f_connectionId = connectionId;
188          return (T)this;
189       }
190    
191       public void clearConnectionId() {
192          loadAndClear();
193          this.b_connectionId = false;
194          this.f_connectionId = null;
195       }
196    
197       // required int64 transaction_id = 1;
198       private long f_transactionId = 0;
199       private boolean b_transactionId;
200    
201       public boolean hasTransactionId() {
202          return this.b_transactionId;
203       }
204    
205       public long getTransactionId() {
206          return this.f_transactionId;
207       }
208    
209       public T setTransactionId(long transactionId) {
210          loadAndClear();
211          this.b_transactionId = true;
212          this.f_transactionId = transactionId;
213          return (T)this;
214       }
215    
216       public void clearTransactionId() {
217          loadAndClear();
218          this.b_transactionId = false;
219          this.f_transactionId = 0;
220       }
221    
222    }
223