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

org.apache.activemq.apollo.mqtt.TopicPB 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 TopicPB implements org.fusesource.hawtbuf.proto.PBMessageFactory {

   public static final TopicPB FACTORY = new TopicPB();
   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 name = 1;
      public boolean hasName();
      public org.fusesource.hawtbuf.UTF8Buffer getName();
      // optional int32 qos = 2;
      public boolean hasQos();
      public int getQos();
      // optional bytes address = 3;
      public boolean hasAddress();
      public org.fusesource.hawtbuf.UTF8Buffer getAddress();
      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_name = other.f_name;
         this.f_qos = other.f_qos;
         this.b_qos = other.b_qos;
         this.f_address = other.f_address;
      }

      // optional bytes name = 1;
      private org.fusesource.hawtbuf.UTF8Buffer f_name = null;

      public boolean hasName() {
         return bean.f_name!=null;
      }

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

      public Bean setName(org.fusesource.hawtbuf.UTF8Buffer name) {
         copyCheck();
         this.f_name = name;
         return this;
      }

      public void clearName() {
         copyCheck();
         this.f_name = null;
      }

      // optional int32 qos = 2;
      private int f_qos = 0;
      private boolean b_qos;

      public boolean hasQos() {
         return bean.b_qos;
      }

      public int getQos() {
         return bean.f_qos;
      }

      public Bean setQos(int qos) {
         copyCheck();
         this.b_qos = true;
         this.f_qos = qos;
         return this;
      }

      public void clearQos() {
         copyCheck();
         this.b_qos = false;
         this.f_qos = 0;
      }

      // optional bytes address = 3;
      private org.fusesource.hawtbuf.UTF8Buffer f_address = null;

      public boolean hasAddress() {
         return bean.f_address!=null;
      }

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

      public Bean setAddress(org.fusesource.hawtbuf.UTF8Buffer address) {
         copyCheck();
         this.f_address = address;
         return this;
      }

      public void clearAddress() {
         copyCheck();
         this.f_address = null;
      }

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

      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
         if(  hasName() ) {
            sb.append(prefix+"name: ");
            sb.append(getName());
            sb.append("\n");
         }
         if(  hasQos() ) {
            sb.append(prefix+"qos: ");
            sb.append(getQos());
            sb.append("\n");
         }
         if(  hasAddress() ) {
            sb.append(prefix+"address: ");
            sb.append(getAddress());
            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:
               setName(new org.fusesource.hawtbuf.UTF8Buffer(input.readBytes()));
               break;
            case 16:
               setQos(input.readInt32());
               break;
            case 26:
               setAddress(new org.fusesource.hawtbuf.UTF8Buffer(input.readBytes()));
               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 (hasName() ^ obj.hasName() ) 
            return false;
         if (hasName() && ( !getName().equals(obj.getName()) ))
            return false;
         if (hasQos() ^ obj.hasQos() ) 
            return false;
         if (hasQos() && ( getQos()!=obj.getQos() ))
            return false;
         if (hasAddress() ^ obj.hasAddress() ) 
            return false;
         if (hasAddress() && ( !getAddress().equals(obj.getAddress()) ))
            return false;
         return true;
      }
      
      public int hashCode() {
         int rc=2066384;
         if (hasName()) {
            rc ^= ( 2420395^getName().hashCode() );
         }
         if (hasQos()) {
            rc ^= ( 81397^getQos() );
         }
         if (hasAddress()) {
            rc ^= ( 516961236^getAddress().hashCode() );
         }
         return rc;
      }
      
      public Bean mergeFrom(Getter other) {
         copyCheck();
         if (other.hasName()) {
            setName(other.getName());
         }
         if (other.hasQos()) {
            setQos(other.getQos());
         }
         if (other.hasAddress()) {
            setAddress(other.getAddress());
         }
         return this;
      }

      public void clear() {
         clearName();
         clearQos();
         clearAddress();
      }

      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_name = new org.fusesource.hawtbuf.UTF8Buffer(b);
            } else {
               f_name = null;
            }
         }
         f_qos = in.readInt();
         b_qos = true;
         {
            int size = in.readInt();
            if( size>=0 ) {
               byte b[] = new byte[size];
               in.readFully(b);
               f_address = new org.fusesource.hawtbuf.UTF8Buffer(b);
            } else {
               f_address = null;
            }
         }
      }

      public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
         if( bean.f_name!=null ) {
            out.writeInt(bean.f_name.getLength());
            out.write(bean.f_name.getData(), bean.f_name.getOffset(), bean.f_name.getLength());
         } else {
            out.writeInt(-1);
         }
         out.writeInt(bean.f_qos);
         if( bean.f_address!=null ) {
            out.writeInt(bean.f_address.getLength());
            out.write(bean.f_address.getData(), bean.f_address.getOffset(), bean.f_address.getLength());
         } else {
            out.writeInt(-1);
         }
      }

   }

   static public final class Buffer implements org.fusesource.hawtbuf.proto.MessageBuffer, 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 name = 1;
      public boolean hasName() {
         return bean().hasName();
      }

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

      // optional int32 qos = 2;
      public boolean hasQos() {
         return bean().hasQos();
      }

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

      // optional bytes address = 3;
      public boolean hasAddress() {
         return bean().hasAddress();
      }

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

      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.hasName()) {
               output.writeBytes(1, bean.getName());
            }
            if (bean.hasQos()) {
               output.writeInt32(2, bean.getQos());
            }
            if (bean.hasAddress()) {
               output.writeBytes(3, bean.getAddress());
            }
            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 (hasName()) {
            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(1, getName());
         }
         if (hasQos()) {
            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt32Size(2, getQos());
         }
         if (hasAddress()) {
            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(3, getAddress());
         }
         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