All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.activemq.apollo.mqtt.SessionPB Maven / Gradle / Ivy

There is a newer version: 1.7.1
Show newest version
//
// Generated by protoc, do not edit by hand.
//
package org.apache.activemq.apollo.mqtt;


public class SessionPB implements org.fusesource.hawtbuf.proto.PBMessageFactory {

   public static final SessionPB FACTORY = new SessionPB();
   public static final org.fusesource.hawtbuf.proto.PBMessageFramedCodec FRAMED_CODEC = new org.fusesource.hawtbuf.proto.PBMessageFramedCodec(FACTORY);
   public static final org.fusesource.hawtbuf.proto.PBMessageUnframedCodec UNFRAMED_CODEC = new org.fusesource.hawtbuf.proto.PBMessageUnframedCodec(FACTORY);

   public Bean create()  {
      return new Bean();
   }

   public Bean parseUnframed(org.fusesource.hawtbuf.proto.CodedInputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
      return new Bean().mergeUnframed(data);
   }

   public Bean parseUnframed(java.io.InputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
      return parseUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(data));
   }

   public Buffer parseUnframed(org.fusesource.hawtbuf.Buffer data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
      return new Buffer(data);
   }

   public Buffer parseUnframed(byte[] data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
      return parseUnframed(new org.fusesource.hawtbuf.Buffer(data));
   }

   public Buffer parseFramed(org.fusesource.hawtbuf.proto.CodedInputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
      int length = data.readRawVarint32();
      int oldLimit = data.pushLimit(length);
      Buffer rc = parseUnframed(data.readRawBytes(length));
      data.popLimit(oldLimit);
      return rc;
   }

   public Buffer parseFramed(org.fusesource.hawtbuf.Buffer data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
      try {
         org.fusesource.hawtbuf.proto.CodedInputStream input = new org.fusesource.hawtbuf.proto.CodedInputStream(data);
         Buffer rc = parseFramed(input);
         input.checkLastTagWas(0);
         return rc;
      } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
         throw e;
      } catch (java.io.IOException e) {
         throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
      }
   }

   public Buffer parseFramed(byte[] data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException {
      return parseFramed(new org.fusesource.hawtbuf.Buffer(data));
   }

   public Buffer parseFramed(java.io.InputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException {
      return parseUnframed(org.fusesource.hawtbuf.proto.MessageBufferSupport.readFrame(data));
   }

   public interface Getter extends org.fusesource.hawtbuf.proto.PBMessage {

      // optional bytes client_id = 1;
      public boolean hasClientId();
      public org.fusesource.hawtbuf.UTF8Buffer getClientId();
      // repeated TopicPB subscriptions = 2;
      public boolean hasSubscriptions();
      public java.util.List getSubscriptionsList();
      public int getSubscriptionsCount();
      public TopicPB.Getter getSubscriptions(int index);
      // repeated int32 received_message_ids = 3;
      public boolean hasReceivedMessageIds();
      public java.util.List getReceivedMessageIdsList();
      public int getReceivedMessageIdsCount();
      public java.lang.Integer getReceivedMessageIds(int index);
      public Bean copy();
      public Buffer freeze();
      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix);
   }

   static public final class Bean implements Getter {

      Buffer frozen;
      Bean bean;

      public Bean() {
         this.bean = this;
      }

      public Bean(Bean copy) {
         this.bean = copy;
      }

      public Bean copy() {
         return new Bean(bean);
      }

      public boolean frozen() {
         return frozen!=null;
      }

      public Buffer freeze() {
         if( frozen==null ) {
            frozen = new Buffer(bean);
            assert deepFreeze();
         }
         return frozen;
      }

      private boolean deepFreeze() {
         frozen.serializedSizeUnframed();
         return true;
      }

      private void copyCheck() {
         assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
         if (bean != this) {
            copy(bean);
         }
      }

      private void copy(Bean other) {
         this.bean = this;
         this.f_clientId = other.f_clientId;
         this.f_subscriptions = other.f_subscriptions;
         if( this.f_subscriptions !=null) {
            this.f_subscriptions = new java.util.ArrayList(other.f_subscriptions.size());
            for( TopicPB.Getter e :  other.f_subscriptions) {
               this.f_subscriptions.add(e.copy());
            }
         }
         this.f_receivedMessageIds = other.f_receivedMessageIds;
         if( this.f_receivedMessageIds !=null && !other.frozen()) {
            this.f_receivedMessageIds = new java.util.ArrayList(this.f_receivedMessageIds);
         }
      }

      // optional bytes client_id = 1;
      private org.fusesource.hawtbuf.UTF8Buffer f_clientId = null;

      public boolean hasClientId() {
         return bean.f_clientId!=null;
      }

      public org.fusesource.hawtbuf.UTF8Buffer getClientId() {
         return bean.f_clientId;
      }

      public Bean setClientId(org.fusesource.hawtbuf.UTF8Buffer clientId) {
         copyCheck();
         this.f_clientId = clientId;
         return this;
      }

      public void clearClientId() {
         copyCheck();
         this.f_clientId = null;
      }

      // repeated TopicPB subscriptions = 2;
      private java.util.List f_subscriptions;

      public boolean hasSubscriptions() {
         return bean.f_subscriptions!=null && !bean.f_subscriptions.isEmpty();
      }

      public java.util.List getSubscriptionsList() {
         return bean.f_subscriptions;
      }

      public java.util.List createSubscriptionsList() {
         copyCheck();
         if( this.f_subscriptions == null ) {
            this.f_subscriptions = new java.util.ArrayList();
         }
         return bean.f_subscriptions;
      }

      public Bean setSubscriptionsList(java.util.List subscriptions) {
         copyCheck();
         this.f_subscriptions = subscriptions;
         return this;
      }

      public int getSubscriptionsCount() {
         if( bean.f_subscriptions == null ) {
            return 0;
         }
         return bean.f_subscriptions.size();
      }

      public TopicPB.Getter getSubscriptions(int index) {
         if( bean.f_subscriptions == null ) {
            return null;
         }
         return bean.f_subscriptions.get(index);
      }

      public Bean setSubscriptions(int index, TopicPB.Getter value) {
         this.createSubscriptionsList().set(index, value);
         return this;
      }

      public Bean addSubscriptions(TopicPB.Getter value) {
         this.createSubscriptionsList().add(value);
         return this;
      }

      public Bean addAllSubscriptions(java.lang.Iterable collection) {
         org.fusesource.hawtbuf.proto.MessageBufferSupport.addAll(collection, this.createSubscriptionsList());
         return this;
      }

      public void clearSubscriptions() {
         copyCheck();
         this.f_subscriptions = null;
      }

      // repeated int32 received_message_ids = 3;
      private java.util.List f_receivedMessageIds;

      public boolean hasReceivedMessageIds() {
         return bean.f_receivedMessageIds!=null && !bean.f_receivedMessageIds.isEmpty();
      }

      public java.util.List getReceivedMessageIdsList() {
         return bean.f_receivedMessageIds;
      }

      public java.util.List createReceivedMessageIdsList() {
         copyCheck();
         if( this.f_receivedMessageIds == null ) {
            this.f_receivedMessageIds = new java.util.ArrayList();
         }
         return bean.f_receivedMessageIds;
      }

      public Bean setReceivedMessageIdsList(java.util.List receivedMessageIds) {
         copyCheck();
         this.f_receivedMessageIds = receivedMessageIds;
         return this;
      }

      public int getReceivedMessageIdsCount() {
         if( bean.f_receivedMessageIds == null ) {
            return 0;
         }
         return bean.f_receivedMessageIds.size();
      }

      public java.lang.Integer getReceivedMessageIds(int index) {
         if( bean.f_receivedMessageIds == null ) {
            return null;
         }
         return bean.f_receivedMessageIds.get(index);
      }

      public Bean setReceivedMessageIds(int index, java.lang.Integer value) {
         this.createReceivedMessageIdsList().set(index, value);
         return this;
      }

      public Bean addReceivedMessageIds(java.lang.Integer value) {
         this.createReceivedMessageIdsList().add(value);
         return this;
      }

      public Bean addAllReceivedMessageIds(java.lang.Iterable collection) {
         org.fusesource.hawtbuf.proto.MessageBufferSupport.addAll(collection, this.createReceivedMessageIdsList());
         return this;
      }

      public void clearReceivedMessageIds() {
         copyCheck();
         this.f_receivedMessageIds = null;
      }

      public String toString() {
         return toString(new java.lang.StringBuilder(), "").toString();
      }

      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
         if(  hasClientId() ) {
            sb.append(prefix+"client_id: ");
            sb.append(getClientId());
            sb.append("\n");
         }
         if(  hasSubscriptions() ) {
            java.util.List l = getSubscriptionsList();
            for( int i=0; i < l.size(); i++ ) {
               sb.append(prefix+"subscriptions["+i+"] {\n");
               l.get(i).toString(sb, prefix+"  ");
               sb.append(prefix+"}\n");
            }
         }
         if(  hasReceivedMessageIds() ) {
            java.util.List l = getReceivedMessageIdsList();
            for( int i=0; i < l.size(); i++ ) {
               sb.append(prefix+"received_message_ids["+i+"]: ");
               sb.append(l.get(i));
               sb.append("\n");
            }
         }
         return sb;
      }

      public Bean mergeUnframed(java.io.InputStream input) throws java.io.IOException {
         return mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(input));
      }

      public Bean mergeUnframed(org.fusesource.hawtbuf.proto.CodedInputStream input) throws java.io.IOException {
         copyCheck();
         while (true) {
            int tag = input.readTag();
            if ((tag & 0x07) == 4) {
               return this;
            }
            switch (tag) {
            case 0:
               return this;
            default: {
               break;
            }
            case 10:
               setClientId(new org.fusesource.hawtbuf.UTF8Buffer(input.readBytes()));
               break;
            case 18:
               createSubscriptionsList().add(TopicPB.FACTORY.parseFramed(input));
               break;
            case 24:
               createReceivedMessageIdsList().add(input.readInt32());
               break;
            }
         }
      }
      public boolean equals(Object obj) {
         if( obj==this )
            return true;
         
         if( obj==null || obj.getClass()!=Bean.class )
            return false;
         
         return equals((Bean)obj);
      }
      
      public boolean equals(Bean obj) {
         if (hasClientId() ^ obj.hasClientId() ) 
            return false;
         if (hasClientId() && ( !getClientId().equals(obj.getClientId()) ))
            return false;
         if (hasSubscriptions() ^ obj.hasSubscriptions() ) 
            return false;
         if (hasSubscriptions() && ( !getSubscriptionsList().equals(obj.getSubscriptionsList()) ))
            return false;
         if (hasReceivedMessageIds() ^ obj.hasReceivedMessageIds() ) 
            return false;
         if (hasReceivedMessageIds() && ( !getReceivedMessageIdsList().equals(obj.getReceivedMessageIdsList()) ))
            return false;
         return true;
      }
      
      public int hashCode() {
         int rc=2066384;
         if (hasClientId()) {
            rc ^= ( 973052518^getClientId().hashCode() );
         }
         if (hasSubscriptions()) {
            rc ^= ( -1508640042^getSubscriptionsList().hashCode() );
         }
         if (hasReceivedMessageIds()) {
            rc ^= ( 1368173074^getReceivedMessageIdsList().hashCode() );
         }
         return rc;
      }
      
      public Bean mergeFrom(Getter other) {
         copyCheck();
         if (other.hasClientId()) {
            setClientId(other.getClientId());
         }
         if (other.hasSubscriptions()) {
            for(TopicPB.Getter element: other.getSubscriptionsList() ) {
               getSubscriptionsList().add(element.copy());
            }
         }
         if (other.hasReceivedMessageIds()) {
            getReceivedMessageIdsList().addAll(other.getReceivedMessageIdsList());
         }
         return this;
      }

      public void clear() {
         clearClientId();
         clearSubscriptions();
         clearReceivedMessageIds();
      }

      public void readExternal(java.io.DataInput in) throws java.io.IOException {
         assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
         bean = this;
         frozen = null;
         {
            int size = in.readInt();
            if( size>=0 ) {
               byte b[] = new byte[size];
               in.readFully(b);
               f_clientId = new org.fusesource.hawtbuf.UTF8Buffer(b);
            } else {
               f_clientId = null;
            }
         }
         {
            int size = in.readShort();
            if( size>=0 ) {
               f_subscriptions = new java.util.ArrayList(size);
               for(int i=0; i=0 ) {
               f_receivedMessageIds = new java.util.ArrayList(size);
               for(int i=0; i, Getter {

      private Bean bean;
      private org.fusesource.hawtbuf.Buffer buffer;
      private int size=-1;
      private int hashCode;

      private Buffer(org.fusesource.hawtbuf.Buffer buffer) {
         this.buffer = buffer;
      }

      private Buffer(Bean bean) {
         this.bean = bean;
      }

      public Bean copy() {
         return bean().copy();
      }

      public Buffer freeze() {
         return this;
      }

      private Bean bean() {
         if (bean == null) {
            try {
               bean = new Bean().mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(buffer));
               bean.frozen=this;
            } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) {
               throw new RuntimeException(e);
            } catch (java.io.IOException e) {
               throw new RuntimeException("An IOException was thrown (should never happen in this method).", e);
            }
         }
         return bean;
      }

      public String toString() {
         return bean().toString();
      }

      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
         return bean().toString(sb, prefix);
      }

      // optional bytes client_id = 1;
      public boolean hasClientId() {
         return bean().hasClientId();
      }

      public org.fusesource.hawtbuf.UTF8Buffer getClientId() {
         return bean().getClientId();
      }

      // repeated TopicPB subscriptions = 2;
      public boolean hasSubscriptions() {
         return bean().hasSubscriptions();
      }

      public java.util.List getSubscriptionsList() {
         return bean().getSubscriptionsList();
      }

      public int getSubscriptionsCount() {
         return bean().getSubscriptionsCount();
      }

      public TopicPB.Getter getSubscriptions(int index) {
         return bean().getSubscriptions(index);
      }

      // repeated int32 received_message_ids = 3;
      public boolean hasReceivedMessageIds() {
         return bean().hasReceivedMessageIds();
      }

      public java.util.List getReceivedMessageIdsList() {
         return bean().getReceivedMessageIdsList();
      }

      public int getReceivedMessageIdsCount() {
         return bean().getReceivedMessageIdsCount();
      }

      public java.lang.Integer getReceivedMessageIds(int index) {
         return bean().getReceivedMessageIds(index);
      }

      public org.fusesource.hawtbuf.Buffer toUnframedBuffer() {
         if( buffer !=null ) {
            return buffer;
         }
         return org.fusesource.hawtbuf.proto.MessageBufferSupport.toUnframedBuffer(this);
      }

      public org.fusesource.hawtbuf.Buffer toFramedBuffer() {
         return org.fusesource.hawtbuf.proto.MessageBufferSupport.toFramedBuffer(this);
      }

      public byte[] toUnframedByteArray() {
         return toUnframedBuffer().toByteArray();
      }

      public byte[] toFramedByteArray() {
         return toFramedBuffer().toByteArray();
      }

      public void writeFramed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
         output.writeRawVarint32(serializedSizeUnframed());
         writeUnframed(output);
      }

      public void writeFramed(java.io.OutputStream output) throws java.io.IOException {
         org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
         writeFramed(codedOutput);
         codedOutput.flush();
      }

      public void writeUnframed(java.io.OutputStream output) throws java.io.IOException {
         org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output);
         writeUnframed(codedOutput);
         codedOutput.flush();
      }

      public void writeUnframed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException {
         if (buffer == null) {
            int size = serializedSizeUnframed();
            buffer = output.getNextBuffer(size);
            org.fusesource.hawtbuf.proto.CodedOutputStream original=null;
            if( buffer == null ) {
               buffer = new org.fusesource.hawtbuf.Buffer(new byte[size]);
               original = output;
               output = new org.fusesource.hawtbuf.proto.CodedOutputStream(buffer);
            }
            if (bean.hasClientId()) {
               output.writeBytes(1, bean.getClientId());
            }
            if (bean.hasSubscriptions()) {
               for (TopicPB.Getter i : bean.getSubscriptionsList()) {
                  org.fusesource.hawtbuf.proto.MessageBufferSupport.writeMessage(output, 2, i.freeze());
               }
            }
            if (bean.hasReceivedMessageIds()) {
               for (int i : bean.getReceivedMessageIdsList()) {
                  output.writeInt32(3, i);
               }
            }
            if( original !=null ) {
               output.checkNoSpaceLeft();
               output = original;
               output.writeRawBytes(buffer);
            }
         } else {
            output.writeRawBytes(buffer);
         }
      }

      public int serializedSizeFramed() {
         int t = serializedSizeUnframed();
         return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t;
      }

      public int serializedSizeUnframed() {
         if (buffer != null) {
            return buffer.length;
         }
         if (size != -1)
            return size;

         size = 0;
         if (hasClientId()) {
            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(1, getClientId());
         }
         if (hasSubscriptions()) {
            for (TopicPB.Getter i : getSubscriptionsList()) {
               size += org.fusesource.hawtbuf.proto.MessageBufferSupport.computeMessageSize(2, i.freeze());
            }
         }
         if (hasReceivedMessageIds()) {
            for (int i : getReceivedMessageIdsList()) {
               size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt32Size(3, i);
            }
         }
         return size;
      }

      public boolean equals(Object obj) {
         if( obj==this )
            return true;
         
         if( obj==null || obj.getClass()!=Buffer.class )
            return false;
         
         return equals((Buffer)obj);
      }
      
      public boolean equals(Buffer obj) {
         return toUnframedBuffer().equals(obj.toUnframedBuffer());
      }
      
      public int hashCode() {
         if( hashCode==0 ) {
         hashCode=2000715872 ^ toUnframedBuffer().hashCode();
         }
         return hashCode;
      }
      
      public boolean frozen() {
         return true;
      }
   }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy