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 KahaProducerAuditCommand extends KahaProducerAuditCommandBase<KahaProducerAuditCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaProducerAuditCommand> {
008    
009       public java.util.ArrayList<String> missingFields() {
010          java.util.ArrayList<String> missingFields = super.missingFields();
011          if(  !hasAudit() ) {
012             missingFields.add("audit");
013          }
014          return missingFields;
015       }
016    
017       public void clear() {
018          super.clear();
019          clearAudit();
020       }
021    
022       public KahaProducerAuditCommand clone() {
023          return new KahaProducerAuditCommand().mergeFrom(this);
024       }
025    
026       public KahaProducerAuditCommand mergeFrom(KahaProducerAuditCommand other) {
027          if (other.hasAudit()) {
028             setAudit(other.getAudit());
029          }
030          return this;
031       }
032    
033       public int serializedSizeUnframed() {
034          if (memoizedSerializedSize != -1)
035             return memoizedSerializedSize;
036    
037          int size = 0;
038          if (hasAudit()) {
039             size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize(1, getAudit());
040          }
041          memoizedSerializedSize = size;
042          return size;
043       }
044    
045       public KahaProducerAuditCommand mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
046          while (true) {
047             int tag = input.readTag();
048             if ((tag & 0x07) == 4) {
049                return this;
050             }
051             switch (tag) {
052             case 0:
053                return this;
054             default: {
055                break;
056             }
057             case 10:
058                setAudit(input.readBytes());
059                break;
060             }
061          }
062       }
063       public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
064          if (hasAudit()) {
065             output.writeBytes(1, getAudit());
066          }
067       }
068    
069       public static KahaProducerAuditCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
070          return new KahaProducerAuditCommand().mergeUnframed(data).checktInitialized();
071       }
072    
073       public static KahaProducerAuditCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
074          return new KahaProducerAuditCommand().mergeUnframed(data).checktInitialized();
075       }
076    
077       public static KahaProducerAuditCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
078          return new KahaProducerAuditCommand().mergeUnframed(data).checktInitialized();
079       }
080    
081       public static KahaProducerAuditCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
082          return new KahaProducerAuditCommand().mergeUnframed(data).checktInitialized();
083       }
084    
085       public static KahaProducerAuditCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
086          return new KahaProducerAuditCommand().mergeFramed(data).checktInitialized();
087       }
088    
089       public static KahaProducerAuditCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
090          return new KahaProducerAuditCommand().mergeFramed(data).checktInitialized();
091       }
092    
093       public static KahaProducerAuditCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
094          return new KahaProducerAuditCommand().mergeFramed(data).checktInitialized();
095       }
096    
097       public static KahaProducerAuditCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
098          return new KahaProducerAuditCommand().mergeFramed(data).checktInitialized();
099       }
100    
101       public String toString() {
102          return toString(new java.lang.StringBuilder(), "").toString();
103       }
104    
105       public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
106          if(  hasAudit() ) {
107             sb.append(prefix+"audit: ");
108             sb.append(getAudit());
109             sb.append("\n");
110          }
111          return sb;
112       }
113    
114       public void visit(org.apache.activemq.store.kahadb.Visitor visitor) throws java.io.IOException {
115          visitor.visit(this);
116       }
117    
118       public KahaEntryType type() {
119          return KahaEntryType.KAHA_PRODUCER_AUDIT_COMMAND;
120       }
121    
122       public boolean equals(Object obj) {
123          if( obj==this )
124             return true;
125          
126          if( obj==null || obj.getClass()!=KahaProducerAuditCommand.class )
127             return false;
128          
129          return equals((KahaProducerAuditCommand)obj);
130       }
131       
132       public boolean equals(KahaProducerAuditCommand obj) {
133          if (hasAudit() ^ obj.hasAudit() ) 
134             return false;
135          if (hasAudit() && ( !getAudit().equals(obj.getAudit()) ))
136             return false;
137          return true;
138       }
139       
140       public int hashCode() {
141          int rc=691941169;
142          if (hasAudit()) {
143             rc ^= ( 63613883^getAudit().hashCode() );
144          }
145          return rc;
146       }
147       
148    }
149    
150    abstract class KahaProducerAuditCommandBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
151    
152       // required bytes audit = 1;
153       private org.apache.activemq.protobuf.Buffer f_audit = null;
154       private boolean b_audit;
155    
156       public boolean hasAudit() {
157          return this.b_audit;
158       }
159    
160       public org.apache.activemq.protobuf.Buffer getAudit() {
161          return this.f_audit;
162       }
163    
164       public T setAudit(org.apache.activemq.protobuf.Buffer audit) {
165          loadAndClear();
166          this.b_audit = true;
167          this.f_audit = audit;
168          return (T)this;
169       }
170    
171       public void clearAudit() {
172          loadAndClear();
173          this.b_audit = false;
174          this.f_audit = null;
175       }
176    
177    }
178