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

org.apache.activemq.leveldb.record.CollectionRecord Maven / Gradle / Ivy

There is a newer version: 6.1.2
Show newest version
//
// Generated by protoc, do not edit by hand.
//
package org.apache.activemq.leveldb.record;


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

   public static final CollectionRecord FACTORY = new CollectionRecord();
   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 int64 key = 1;
      public boolean hasKey();
      public long getKey();
      // optional int32 type = 2;
      public boolean hasType();
      public int getType();
      // optional bytes meta = 3;
      public boolean hasMeta();
      public org.fusesource.hawtbuf.Buffer getMeta();
      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_key = other.f_key;
         this.b_key = other.b_key;
         this.f_type = other.f_type;
         this.b_type = other.b_type;
         this.f_meta = other.f_meta;
      }

      // optional int64 key = 1;
      private long f_key = 0;
      private boolean b_key;

      public boolean hasKey() {
         return bean.b_key;
      }

      public long getKey() {
         return bean.f_key;
      }

      public Bean setKey(long key) {
         copyCheck();
         this.b_key = true;
         this.f_key = key;
         return this;
      }

      public void clearKey() {
         copyCheck();
         this.b_key = false;
         this.f_key = 0;
      }

      // optional int32 type = 2;
      private int f_type = 0;
      private boolean b_type;

      public boolean hasType() {
         return bean.b_type;
      }

      public int getType() {
         return bean.f_type;
      }

      public Bean setType(int type) {
         copyCheck();
         this.b_type = true;
         this.f_type = type;
         return this;
      }

      public void clearType() {
         copyCheck();
         this.b_type = false;
         this.f_type = 0;
      }

      // optional bytes meta = 3;
      private org.fusesource.hawtbuf.Buffer f_meta = null;

      public boolean hasMeta() {
         return bean.f_meta!=null;
      }

      public org.fusesource.hawtbuf.Buffer getMeta() {
         return bean.f_meta;
      }

      public Bean setMeta(org.fusesource.hawtbuf.Buffer meta) {
         copyCheck();
         this.f_meta = meta;
         return this;
      }

      public void clearMeta() {
         copyCheck();
         this.f_meta = null;
      }

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

      public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
         if(  hasKey() ) {
            sb.append(prefix+"key: ");
            sb.append(getKey());
            sb.append("\n");
         }
         if(  hasType() ) {
            sb.append(prefix+"type: ");
            sb.append(getType());
            sb.append("\n");
         }
         if(  hasMeta() ) {
            sb.append(prefix+"meta: ");
            sb.append(getMeta());
            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: {
               input.skipField(tag);
               break;
            }
            case 8:
               setKey(input.readInt64());
               break;
            case 16:
               setType(input.readInt32());
               break;
            case 26:
               setMeta(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 (hasKey() ^ obj.hasKey() ) 
            return false;
         if (hasKey() && ( getKey()!=obj.getKey() ))
            return false;
         if (hasType() ^ obj.hasType() ) 
            return false;
         if (hasType() && ( getType()!=obj.getType() ))
            return false;
         if (hasMeta() ^ obj.hasMeta() ) 
            return false;
         if (hasMeta() && ( !getMeta().equals(obj.getMeta()) ))
            return false;
         return true;
      }
      
      public int hashCode() {
         int rc=2066384;
         if (hasKey()) {
            rc ^= ( 75327^(new Long(getKey())).hashCode() );
         }
         if (hasType()) {
            rc ^= ( 2622298^getType() );
         }
         if (hasMeta()) {
            rc ^= ( 2394661^getMeta().hashCode() );
         }
         return rc;
      }
      
      public Bean mergeFrom(Getter other) {
         copyCheck();
         if (other.hasKey()) {
            setKey(other.getKey());
         }
         if (other.hasType()) {
            setType(other.getType());
         }
         if (other.hasMeta()) {
            setMeta(other.getMeta());
         }
         return this;
      }

      public void clear() {
         clearKey();
         clearType();
         clearMeta();
      }

      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;
         f_key = in.readLong();
         b_key = true;
         f_type = in.readInt();
         b_type = true;
         {
            int size = in.readInt();
            if( size>=0 ) {
               byte b[] = new byte[size];
               in.readFully(b);
               f_meta = new org.fusesource.hawtbuf.Buffer(b);
            } else {
               f_meta = null;
            }
         }
      }

      public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
         out.writeLong(bean.f_key);
         out.writeInt(bean.f_type);
         if( bean.f_meta!=null ) {
            out.writeInt(bean.f_meta.getLength());
            out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.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 int64 key = 1;
      public boolean hasKey() {
         return bean().hasKey();
      }

      public long getKey() {
         return bean().getKey();
      }

      // optional int32 type = 2;
      public boolean hasType() {
         return bean().hasType();
      }

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

      // optional bytes meta = 3;
      public boolean hasMeta() {
         return bean().hasMeta();
      }

      public org.fusesource.hawtbuf.Buffer getMeta() {
         return bean().getMeta();
      }

      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.hasKey()) {
               output.writeInt64(1, bean.getKey());
            }
            if (bean.hasType()) {
               output.writeInt32(2, bean.getType());
            }
            if (bean.hasMeta()) {
               output.writeBytes(3, bean.getMeta());
            }
            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 (hasKey()) {
            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(1, getKey());
         }
         if (hasType()) {
            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt32Size(2, getType());
         }
         if (hasMeta()) {
            size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(3, getMeta());
         }
         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