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 KahaDestination extends KahaDestinationBase<KahaDestination> {
008    
009    
010       public static enum DestinationType {
011    
012          QUEUE("QUEUE", 0),
013          TOPIC("TOPIC", 1),
014          TEMP_QUEUE("TEMP_QUEUE", 2),
015          TEMP_TOPIC("TEMP_TOPIC", 3);
016    
017          private final String name;
018          private final int value;
019    
020          private DestinationType(String name, int value) {
021             this.name = name;
022             this.value = value;
023          }
024    
025          public final int getNumber() {
026             return value;
027          }
028    
029          public final String toString() {
030             return name;
031          }
032    
033          public static DestinationType valueOf(int value) {
034             switch (value) {
035             case 0:
036                return QUEUE;
037             case 1:
038                return TOPIC;
039             case 2:
040                return TEMP_QUEUE;
041             case 3:
042                return TEMP_TOPIC;
043             default:
044                return null;
045             }
046          }
047    
048       }
049    
050       public java.util.ArrayList<String> missingFields() {
051          java.util.ArrayList<String> missingFields = super.missingFields();
052          if(  !hasType() ) {
053             missingFields.add("type");
054          }
055          if(  !hasName() ) {
056             missingFields.add("name");
057          }
058          return missingFields;
059       }
060    
061       public void clear() {
062          super.clear();
063          clearType();
064          clearName();
065       }
066    
067       public KahaDestination clone() {
068          return new KahaDestination().mergeFrom(this);
069       }
070    
071       public KahaDestination mergeFrom(KahaDestination other) {
072          if (other.hasType()) {
073             setType(other.getType());
074          }
075          if (other.hasName()) {
076             setName(other.getName());
077          }
078          return this;
079       }
080    
081       public int serializedSizeUnframed() {
082          if (memoizedSerializedSize != -1)
083             return memoizedSerializedSize;
084    
085          int size = 0;
086          if (hasType()) {
087             size += org.apache.activemq.protobuf.CodedOutputStream.computeEnumSize(1, getType().getNumber());
088          }
089          if (hasName()) {
090             size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize(2, getName());
091          }
092          memoizedSerializedSize = size;
093          return size;
094       }
095    
096       public KahaDestination mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
097          while (true) {
098             int tag = input.readTag();
099             if ((tag & 0x07) == 4) {
100                return this;
101             }
102             switch (tag) {
103             case 0:
104                return this;
105             default: {
106                break;
107             }
108             case 8:
109                {
110                   int t = input.readEnum();
111                   KahaDestination.DestinationType value = KahaDestination.DestinationType.valueOf(t);
112                   if( value !=null ) {
113                      setType(value);
114                   }
115                }
116                break;
117             case 18:
118                setName(input.readString());
119                break;
120             }
121          }
122       }
123       public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
124          if (hasType()) {
125             output.writeEnum(1, getType().getNumber());
126          }
127          if (hasName()) {
128             output.writeString(2, getName());
129          }
130       }
131    
132       public static KahaDestination parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
133          return new KahaDestination().mergeUnframed(data).checktInitialized();
134       }
135    
136       public static KahaDestination parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
137          return new KahaDestination().mergeUnframed(data).checktInitialized();
138       }
139    
140       public static KahaDestination parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
141          return new KahaDestination().mergeUnframed(data).checktInitialized();
142       }
143    
144       public static KahaDestination parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
145          return new KahaDestination().mergeUnframed(data).checktInitialized();
146       }
147    
148       public static KahaDestination parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
149          return new KahaDestination().mergeFramed(data).checktInitialized();
150       }
151    
152       public static KahaDestination parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
153          return new KahaDestination().mergeFramed(data).checktInitialized();
154       }
155    
156       public static KahaDestination parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
157          return new KahaDestination().mergeFramed(data).checktInitialized();
158       }
159    
160       public static KahaDestination parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
161          return new KahaDestination().mergeFramed(data).checktInitialized();
162       }
163    
164       public String toString() {
165          return toString(new java.lang.StringBuilder(), "").toString();
166       }
167    
168       public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
169          if(  hasType() ) {
170             sb.append(prefix+"type: ");
171             sb.append(getType());
172             sb.append("\n");
173          }
174          if(  hasName() ) {
175             sb.append(prefix+"name: ");
176             sb.append(getName());
177             sb.append("\n");
178          }
179          return sb;
180       }
181    
182       public boolean equals(Object obj) {
183          if( obj==this )
184             return true;
185          
186          if( obj==null || obj.getClass()!=KahaDestination.class )
187             return false;
188          
189          return equals((KahaDestination)obj);
190       }
191       
192       public boolean equals(KahaDestination obj) {
193          if (hasType() ^ obj.hasType() ) 
194             return false;
195          if (hasType() && ( !getType().equals(obj.getType()) ))
196             return false;
197          if (hasName() ^ obj.hasName() ) 
198             return false;
199          if (hasName() && ( !getName().equals(obj.getName()) ))
200             return false;
201          return true;
202       }
203       
204       public int hashCode() {
205          int rc=-972308577;
206          if (hasType()) {
207             rc ^= ( 2622298^getType().hashCode() );
208          }
209          if (hasName()) {
210             rc ^= ( 2420395^getName().hashCode() );
211          }
212          return rc;
213       }
214       
215    }
216    
217    abstract class KahaDestinationBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
218    
219       // required DestinationType type = 1;
220       private KahaDestination.DestinationType f_type = KahaDestination.DestinationType.QUEUE;
221       private boolean b_type;
222    
223       public boolean hasType() {
224          return this.b_type;
225       }
226    
227       public KahaDestination.DestinationType getType() {
228          return this.f_type;
229       }
230    
231       public T setType(KahaDestination.DestinationType type) {
232          loadAndClear();
233          this.b_type = true;
234          this.f_type = type;
235          return (T)this;
236       }
237    
238       public void clearType() {
239          loadAndClear();
240          this.b_type = false;
241          this.f_type = KahaDestination.DestinationType.QUEUE;
242       }
243    
244       // required string name = 2;
245       private java.lang.String f_name = null;
246       private boolean b_name;
247    
248       public boolean hasName() {
249          return this.b_name;
250       }
251    
252       public java.lang.String getName() {
253          return this.f_name;
254       }
255    
256       public T setName(java.lang.String name) {
257          loadAndClear();
258          this.b_name = true;
259          this.f_name = name;
260          return (T)this;
261       }
262    
263       public void clearName() {
264          loadAndClear();
265          this.b_name = false;
266          this.f_name = null;
267       }
268    
269    }
270