001// 002// Generated by protoc, do not edit by hand. 003// 004package org.apache.activemq.store.kahadb.data; 005 006 007public final class KahaCommitCommand extends KahaCommitCommandBase<KahaCommitCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaCommitCommand> { 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 KahaCommitCommand clone() { 030 return new KahaCommitCommand().mergeFrom(this); 031 } 032 033 public KahaCommitCommand mergeFrom(KahaCommitCommand 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 KahaCommitCommand 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 KahaCommitCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 085 return new KahaCommitCommand().mergeUnframed(data).checktInitialized(); 086 } 087 088 public static KahaCommitCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 089 return new KahaCommitCommand().mergeUnframed(data).checktInitialized(); 090 } 091 092 public static KahaCommitCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 093 return new KahaCommitCommand().mergeUnframed(data).checktInitialized(); 094 } 095 096 public static KahaCommitCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 097 return new KahaCommitCommand().mergeUnframed(data).checktInitialized(); 098 } 099 100 public static KahaCommitCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 101 return new KahaCommitCommand().mergeFramed(data).checktInitialized(); 102 } 103 104 public static KahaCommitCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 105 return new KahaCommitCommand().mergeFramed(data).checktInitialized(); 106 } 107 108 public static KahaCommitCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 109 return new KahaCommitCommand().mergeFramed(data).checktInitialized(); 110 } 111 112 public static KahaCommitCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 113 return new KahaCommitCommand().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_COMMIT_COMMAND; 135 } 136 137 public boolean equals(Object obj) { 138 if( obj==this ) 139 return true; 140 141 if( obj==null || obj.getClass()!=KahaCommitCommand.class ) 142 return false; 143 144 return equals((KahaCommitCommand)obj); 145 } 146 147 public boolean equals(KahaCommitCommand 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=-651907739; 157 if (hasTransactionInfo()) { 158 rc ^= ( 265667724^getTransactionInfo().hashCode() ); 159 } 160 return rc; 161 } 162 163} 164 165abstract class KahaCommitCommandBase<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