001//
002// Generated by protoc, do not edit by hand.
003//
004package org.apache.activemq.store.kahadb.data;
005
006
007public final class KahaRemoveDestinationCommand extends KahaRemoveDestinationCommandBase<KahaRemoveDestinationCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaRemoveDestinationCommand> {
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( hasDestination() ) {
015         try {
016            getDestination().assertInitialized();
017         } catch (org.apache.activemq.protobuf.UninitializedMessageException e){
018            missingFields.addAll(prefix(e.getMissingFields(),"destination."));
019         }
020      }
021      return missingFields;
022   }
023
024   public void clear() {
025      super.clear();
026      clearDestination();
027   }
028
029   public KahaRemoveDestinationCommand clone() {
030      return new KahaRemoveDestinationCommand().mergeFrom(this);
031   }
032
033   public KahaRemoveDestinationCommand mergeFrom(KahaRemoveDestinationCommand other) {
034      if (other.hasDestination()) {
035         if (hasDestination()) {
036            getDestination().mergeFrom(other.getDestination());
037         } else {
038            setDestination(other.getDestination().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 (hasDestination()) {
050         size += computeMessageSize(1, getDestination());
051      }
052      memoizedSerializedSize = size;
053      return size;
054   }
055
056   public KahaRemoveDestinationCommand 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 (hasDestination()) {
070               getDestination().mergeFramed(input);
071            } else {
072               setDestination(new KahaDestination().mergeFramed(input));
073            }
074            break;
075         }
076      }
077   }
078   public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
079      if (hasDestination()) {
080         writeMessage(output, 1, getDestination());
081      }
082   }
083
084   public static KahaRemoveDestinationCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
085      return new KahaRemoveDestinationCommand().mergeUnframed(data).checktInitialized();
086   }
087
088   public static KahaRemoveDestinationCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
089      return new KahaRemoveDestinationCommand().mergeUnframed(data).checktInitialized();
090   }
091
092   public static KahaRemoveDestinationCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
093      return new KahaRemoveDestinationCommand().mergeUnframed(data).checktInitialized();
094   }
095
096   public static KahaRemoveDestinationCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
097      return new KahaRemoveDestinationCommand().mergeUnframed(data).checktInitialized();
098   }
099
100   public static KahaRemoveDestinationCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
101      return new KahaRemoveDestinationCommand().mergeFramed(data).checktInitialized();
102   }
103
104   public static KahaRemoveDestinationCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
105      return new KahaRemoveDestinationCommand().mergeFramed(data).checktInitialized();
106   }
107
108   public static KahaRemoveDestinationCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
109      return new KahaRemoveDestinationCommand().mergeFramed(data).checktInitialized();
110   }
111
112   public static KahaRemoveDestinationCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
113      return new KahaRemoveDestinationCommand().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(  hasDestination() ) {
122         sb.append(prefix+"destination {\n");
123         getDestination().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_REMOVE_DESTINATION_COMMAND;
135   }
136
137   public boolean equals(Object obj) {
138      if( obj==this )
139         return true;
140      
141      if( obj==null || obj.getClass()!=KahaRemoveDestinationCommand.class )
142         return false;
143      
144      return equals((KahaRemoveDestinationCommand)obj);
145   }
146   
147   public boolean equals(KahaRemoveDestinationCommand obj) {
148      if (hasDestination() ^ obj.hasDestination() ) 
149         return false;
150      if (hasDestination() && ( !getDestination().equals(obj.getDestination()) ))
151         return false;
152      return true;
153   }
154   
155   public int hashCode() {
156      int rc=302570256;
157      if (hasDestination()) {
158         rc ^= ( 238021614^getDestination().hashCode() );
159      }
160      return rc;
161   }
162   
163}
164
165abstract class KahaRemoveDestinationCommandBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
166
167   // required KahaDestination destination = 1;
168   private KahaDestination f_destination = null;
169
170   public boolean hasDestination() {
171      return this.f_destination!=null;
172   }
173
174   public KahaDestination getDestination() {
175      if( this.f_destination == null ) {
176         this.f_destination = new KahaDestination();
177      }
178      return this.f_destination;
179   }
180
181   public T setDestination(KahaDestination destination) {
182      loadAndClear();
183      this.f_destination = destination;
184      return (T)this;
185   }
186
187   public void clearDestination() {
188      loadAndClear();
189      this.f_destination = null;
190   }
191
192}
193