001// 002// Generated by protoc, do not edit by hand. 003// 004package org.apache.activemq.leveldb.record; 005 006 007public class EntryRecord implements org.fusesource.hawtbuf.proto.PBMessageFactory<EntryRecord.Bean, EntryRecord.Buffer> { 008 009 public static final EntryRecord FACTORY = new EntryRecord(); 010 public static final org.fusesource.hawtbuf.proto.PBMessageFramedCodec<Buffer> FRAMED_CODEC = new org.fusesource.hawtbuf.proto.PBMessageFramedCodec<Buffer>(FACTORY); 011 public static final org.fusesource.hawtbuf.proto.PBMessageUnframedCodec<Buffer> UNFRAMED_CODEC = new org.fusesource.hawtbuf.proto.PBMessageUnframedCodec<Buffer>(FACTORY); 012 013 public Bean create() { 014 return new Bean(); 015 } 016 017 public Bean parseUnframed(org.fusesource.hawtbuf.proto.CodedInputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException { 018 return new Bean().mergeUnframed(data); 019 } 020 021 public Bean parseUnframed(java.io.InputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException { 022 return parseUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(data)); 023 } 024 025 public Buffer parseUnframed(org.fusesource.hawtbuf.Buffer data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException { 026 return new Buffer(data); 027 } 028 029 public Buffer parseUnframed(byte[] data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException { 030 return parseUnframed(new org.fusesource.hawtbuf.Buffer(data)); 031 } 032 033 public Buffer parseFramed(org.fusesource.hawtbuf.proto.CodedInputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException { 034 int length = data.readRawVarint32(); 035 int oldLimit = data.pushLimit(length); 036 Buffer rc = parseUnframed(data.readRawBytes(length)); 037 data.popLimit(oldLimit); 038 return rc; 039 } 040 041 public Buffer parseFramed(org.fusesource.hawtbuf.Buffer data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException { 042 try { 043 org.fusesource.hawtbuf.proto.CodedInputStream input = new org.fusesource.hawtbuf.proto.CodedInputStream(data); 044 Buffer rc = parseFramed(input); 045 input.checkLastTagWas(0); 046 return rc; 047 } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) { 048 throw e; 049 } catch (java.io.IOException e) { 050 throw new RuntimeException("An IOException was thrown (should never happen in this method).", e); 051 } 052 } 053 054 public Buffer parseFramed(byte[] data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException { 055 return parseFramed(new org.fusesource.hawtbuf.Buffer(data)); 056 } 057 058 public Buffer parseFramed(java.io.InputStream data) throws org.fusesource.hawtbuf.proto.InvalidProtocolBufferException, java.io.IOException { 059 return parseUnframed(org.fusesource.hawtbuf.proto.MessageBufferSupport.readFrame(data)); 060 } 061 062 public interface Getter extends org.fusesource.hawtbuf.proto.PBMessage<EntryRecord.Bean, EntryRecord.Buffer> { 063 064 // optional int64 collection_key = 1; 065 public boolean hasCollectionKey(); 066 public long getCollectionKey(); 067 // optional bytes entry_key = 2; 068 public boolean hasEntryKey(); 069 public org.fusesource.hawtbuf.Buffer getEntryKey(); 070 // optional int64 value_location = 3; 071 public boolean hasValueLocation(); 072 public long getValueLocation(); 073 // optional int32 value_length = 4; 074 public boolean hasValueLength(); 075 public int getValueLength(); 076 // optional bytes value = 5; 077 public boolean hasValue(); 078 public org.fusesource.hawtbuf.Buffer getValue(); 079 // optional bytes meta = 6; 080 public boolean hasMeta(); 081 public org.fusesource.hawtbuf.Buffer getMeta(); 082 public Bean copy(); 083 public Buffer freeze(); 084 public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix); 085 } 086 087 static public final class Bean implements Getter { 088 089 Buffer frozen; 090 Bean bean; 091 092 public Bean() { 093 this.bean = this; 094 } 095 096 public Bean(Bean copy) { 097 this.bean = copy; 098 } 099 100 public Bean copy() { 101 return new Bean(bean); 102 } 103 104 public boolean frozen() { 105 return frozen!=null; 106 } 107 108 public Buffer freeze() { 109 if( frozen==null ) { 110 frozen = new Buffer(bean); 111 assert deepFreeze(); 112 } 113 return frozen; 114 } 115 116 private boolean deepFreeze() { 117 frozen.serializedSizeUnframed(); 118 return true; 119 } 120 121 private void copyCheck() { 122 assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE; 123 if (bean != this) { 124 copy(bean); 125 } 126 } 127 128 private void copy(Bean other) { 129 this.bean = this; 130 this.f_collectionKey = other.f_collectionKey; 131 this.b_collectionKey = other.b_collectionKey; 132 this.f_entryKey = other.f_entryKey; 133 this.f_valueLocation = other.f_valueLocation; 134 this.b_valueLocation = other.b_valueLocation; 135 this.f_valueLength = other.f_valueLength; 136 this.b_valueLength = other.b_valueLength; 137 this.f_value = other.f_value; 138 this.f_meta = other.f_meta; 139 } 140 141 // optional int64 collection_key = 1; 142 private long f_collectionKey = 0; 143 private boolean b_collectionKey; 144 145 public boolean hasCollectionKey() { 146 return bean.b_collectionKey; 147 } 148 149 public long getCollectionKey() { 150 return bean.f_collectionKey; 151 } 152 153 public Bean setCollectionKey(long collectionKey) { 154 copyCheck(); 155 this.b_collectionKey = true; 156 this.f_collectionKey = collectionKey; 157 return this; 158 } 159 160 public void clearCollectionKey() { 161 copyCheck(); 162 this.b_collectionKey = false; 163 this.f_collectionKey = 0; 164 } 165 166 // optional bytes entry_key = 2; 167 private org.fusesource.hawtbuf.Buffer f_entryKey = null; 168 169 public boolean hasEntryKey() { 170 return bean.f_entryKey!=null; 171 } 172 173 public org.fusesource.hawtbuf.Buffer getEntryKey() { 174 return bean.f_entryKey; 175 } 176 177 public Bean setEntryKey(org.fusesource.hawtbuf.Buffer entryKey) { 178 copyCheck(); 179 this.f_entryKey = entryKey; 180 return this; 181 } 182 183 public void clearEntryKey() { 184 copyCheck(); 185 this.f_entryKey = null; 186 } 187 188 // optional int64 value_location = 3; 189 private long f_valueLocation = 0; 190 private boolean b_valueLocation; 191 192 public boolean hasValueLocation() { 193 return bean.b_valueLocation; 194 } 195 196 public long getValueLocation() { 197 return bean.f_valueLocation; 198 } 199 200 public Bean setValueLocation(long valueLocation) { 201 copyCheck(); 202 this.b_valueLocation = true; 203 this.f_valueLocation = valueLocation; 204 return this; 205 } 206 207 public void clearValueLocation() { 208 copyCheck(); 209 this.b_valueLocation = false; 210 this.f_valueLocation = 0; 211 } 212 213 // optional int32 value_length = 4; 214 private int f_valueLength = 0; 215 private boolean b_valueLength; 216 217 public boolean hasValueLength() { 218 return bean.b_valueLength; 219 } 220 221 public int getValueLength() { 222 return bean.f_valueLength; 223 } 224 225 public Bean setValueLength(int valueLength) { 226 copyCheck(); 227 this.b_valueLength = true; 228 this.f_valueLength = valueLength; 229 return this; 230 } 231 232 public void clearValueLength() { 233 copyCheck(); 234 this.b_valueLength = false; 235 this.f_valueLength = 0; 236 } 237 238 // optional bytes value = 5; 239 private org.fusesource.hawtbuf.Buffer f_value = null; 240 241 public boolean hasValue() { 242 return bean.f_value!=null; 243 } 244 245 public org.fusesource.hawtbuf.Buffer getValue() { 246 return bean.f_value; 247 } 248 249 public Bean setValue(org.fusesource.hawtbuf.Buffer value) { 250 copyCheck(); 251 this.f_value = value; 252 return this; 253 } 254 255 public void clearValue() { 256 copyCheck(); 257 this.f_value = null; 258 } 259 260 // optional bytes meta = 6; 261 private org.fusesource.hawtbuf.Buffer f_meta = null; 262 263 public boolean hasMeta() { 264 return bean.f_meta!=null; 265 } 266 267 public org.fusesource.hawtbuf.Buffer getMeta() { 268 return bean.f_meta; 269 } 270 271 public Bean setMeta(org.fusesource.hawtbuf.Buffer meta) { 272 copyCheck(); 273 this.f_meta = meta; 274 return this; 275 } 276 277 public void clearMeta() { 278 copyCheck(); 279 this.f_meta = null; 280 } 281 282 public String toString() { 283 return toString(new java.lang.StringBuilder(), "").toString(); 284 } 285 286 public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) { 287 if( hasCollectionKey() ) { 288 sb.append(prefix+"collection_key: "); 289 sb.append(getCollectionKey()); 290 sb.append("\n"); 291 } 292 if( hasEntryKey() ) { 293 sb.append(prefix+"entry_key: "); 294 sb.append(getEntryKey()); 295 sb.append("\n"); 296 } 297 if( hasValueLocation() ) { 298 sb.append(prefix+"value_location: "); 299 sb.append(getValueLocation()); 300 sb.append("\n"); 301 } 302 if( hasValueLength() ) { 303 sb.append(prefix+"value_length: "); 304 sb.append(getValueLength()); 305 sb.append("\n"); 306 } 307 if( hasValue() ) { 308 sb.append(prefix+"value: "); 309 sb.append(getValue()); 310 sb.append("\n"); 311 } 312 if( hasMeta() ) { 313 sb.append(prefix+"meta: "); 314 sb.append(getMeta()); 315 sb.append("\n"); 316 } 317 return sb; 318 } 319 320 public Bean mergeUnframed(java.io.InputStream input) throws java.io.IOException { 321 return mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(input)); 322 } 323 324 public Bean mergeUnframed(org.fusesource.hawtbuf.proto.CodedInputStream input) throws java.io.IOException { 325 copyCheck(); 326 while (true) { 327 int tag = input.readTag(); 328 if ((tag & 0x07) == 4) { 329 return this; 330 } 331 switch (tag) { 332 case 0: 333 return this; 334 default: { 335 input.skipField(tag); 336 break; 337 } 338 case 8: 339 setCollectionKey(input.readInt64()); 340 break; 341 case 18: 342 setEntryKey(input.readBytes()); 343 break; 344 case 24: 345 setValueLocation(input.readInt64()); 346 break; 347 case 32: 348 setValueLength(input.readInt32()); 349 break; 350 case 42: 351 setValue(input.readBytes()); 352 break; 353 case 50: 354 setMeta(input.readBytes()); 355 break; 356 } 357 } 358 } 359 public boolean equals(Object obj) { 360 if( obj==this ) 361 return true; 362 363 if( obj==null || obj.getClass()!=Bean.class ) 364 return false; 365 366 return equals((Bean)obj); 367 } 368 369 public boolean equals(Bean obj) { 370 if (hasCollectionKey() ^ obj.hasCollectionKey() ) 371 return false; 372 if (hasCollectionKey() && ( getCollectionKey()!=obj.getCollectionKey() )) 373 return false; 374 if (hasEntryKey() ^ obj.hasEntryKey() ) 375 return false; 376 if (hasEntryKey() && ( !getEntryKey().equals(obj.getEntryKey()) )) 377 return false; 378 if (hasValueLocation() ^ obj.hasValueLocation() ) 379 return false; 380 if (hasValueLocation() && ( getValueLocation()!=obj.getValueLocation() )) 381 return false; 382 if (hasValueLength() ^ obj.hasValueLength() ) 383 return false; 384 if (hasValueLength() && ( getValueLength()!=obj.getValueLength() )) 385 return false; 386 if (hasValue() ^ obj.hasValue() ) 387 return false; 388 if (hasValue() && ( !getValue().equals(obj.getValue()) )) 389 return false; 390 if (hasMeta() ^ obj.hasMeta() ) 391 return false; 392 if (hasMeta() && ( !getMeta().equals(obj.getMeta()) )) 393 return false; 394 return true; 395 } 396 397 public int hashCode() { 398 int rc=2066384; 399 if (hasCollectionKey()) { 400 rc ^= ( -22299967^(new Long(getCollectionKey())).hashCode() ); 401 } 402 if (hasEntryKey()) { 403 rc ^= ( -2029038419^getEntryKey().hashCode() ); 404 } 405 if (hasValueLocation()) { 406 rc ^= ( 1955185702^(new Long(getValueLocation())).hashCode() ); 407 } 408 if (hasValueLength()) { 409 rc ^= ( 28886935^getValueLength() ); 410 } 411 if (hasValue()) { 412 rc ^= ( 82420049^getValue().hashCode() ); 413 } 414 if (hasMeta()) { 415 rc ^= ( 2394661^getMeta().hashCode() ); 416 } 417 return rc; 418 } 419 420 public Bean mergeFrom(Getter other) { 421 copyCheck(); 422 if (other.hasCollectionKey()) { 423 setCollectionKey(other.getCollectionKey()); 424 } 425 if (other.hasEntryKey()) { 426 setEntryKey(other.getEntryKey()); 427 } 428 if (other.hasValueLocation()) { 429 setValueLocation(other.getValueLocation()); 430 } 431 if (other.hasValueLength()) { 432 setValueLength(other.getValueLength()); 433 } 434 if (other.hasValue()) { 435 setValue(other.getValue()); 436 } 437 if (other.hasMeta()) { 438 setMeta(other.getMeta()); 439 } 440 return this; 441 } 442 443 public void clear() { 444 clearCollectionKey(); 445 clearEntryKey(); 446 clearValueLocation(); 447 clearValueLength(); 448 clearValue(); 449 clearMeta(); 450 } 451 452 public void readExternal(java.io.DataInput in) throws java.io.IOException { 453 assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE; 454 bean = this; 455 frozen = null; 456 f_collectionKey = in.readLong(); 457 b_collectionKey = true; 458 { 459 int size = in.readInt(); 460 if( size>=0 ) { 461 byte b[] = new byte[size]; 462 in.readFully(b); 463 f_entryKey = new org.fusesource.hawtbuf.Buffer(b); 464 } else { 465 f_entryKey = null; 466 } 467 } 468 f_valueLocation = in.readLong(); 469 b_valueLocation = true; 470 f_valueLength = in.readInt(); 471 b_valueLength = true; 472 { 473 int size = in.readInt(); 474 if( size>=0 ) { 475 byte b[] = new byte[size]; 476 in.readFully(b); 477 f_value = new org.fusesource.hawtbuf.Buffer(b); 478 } else { 479 f_value = null; 480 } 481 } 482 { 483 int size = in.readInt(); 484 if( size>=0 ) { 485 byte b[] = new byte[size]; 486 in.readFully(b); 487 f_meta = new org.fusesource.hawtbuf.Buffer(b); 488 } else { 489 f_meta = null; 490 } 491 } 492 } 493 494 public void writeExternal(java.io.DataOutput out) throws java.io.IOException { 495 out.writeLong(bean.f_collectionKey); 496 if( bean.f_entryKey!=null ) { 497 out.writeInt(bean.f_entryKey.getLength()); 498 out.write(bean.f_entryKey.getData(), bean.f_entryKey.getOffset(), bean.f_entryKey.getLength()); 499 } else { 500 out.writeInt(-1); 501 } 502 out.writeLong(bean.f_valueLocation); 503 out.writeInt(bean.f_valueLength); 504 if( bean.f_value!=null ) { 505 out.writeInt(bean.f_value.getLength()); 506 out.write(bean.f_value.getData(), bean.f_value.getOffset(), bean.f_value.getLength()); 507 } else { 508 out.writeInt(-1); 509 } 510 if( bean.f_meta!=null ) { 511 out.writeInt(bean.f_meta.getLength()); 512 out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.getLength()); 513 } else { 514 out.writeInt(-1); 515 } 516 } 517 518 } 519 520 static public final class Buffer implements org.fusesource.hawtbuf.proto.MessageBuffer<EntryRecord.Bean, EntryRecord.Buffer>, Getter { 521 522 private Bean bean; 523 private org.fusesource.hawtbuf.Buffer buffer; 524 private int size=-1; 525 private int hashCode; 526 527 private Buffer(org.fusesource.hawtbuf.Buffer buffer) { 528 this.buffer = buffer; 529 } 530 531 private Buffer(Bean bean) { 532 this.bean = bean; 533 } 534 535 public Bean copy() { 536 return bean().copy(); 537 } 538 539 public Buffer freeze() { 540 return this; 541 } 542 543 private Bean bean() { 544 if (bean == null) { 545 try { 546 bean = new Bean().mergeUnframed(new org.fusesource.hawtbuf.proto.CodedInputStream(buffer)); 547 bean.frozen=this; 548 } catch (org.fusesource.hawtbuf.proto.InvalidProtocolBufferException e) { 549 throw new RuntimeException(e); 550 } catch (java.io.IOException e) { 551 throw new RuntimeException("An IOException was thrown (should never happen in this method).", e); 552 } 553 } 554 return bean; 555 } 556 557 public String toString() { 558 return bean().toString(); 559 } 560 561 public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) { 562 return bean().toString(sb, prefix); 563 } 564 565 // optional int64 collection_key = 1; 566 public boolean hasCollectionKey() { 567 return bean().hasCollectionKey(); 568 } 569 570 public long getCollectionKey() { 571 return bean().getCollectionKey(); 572 } 573 574 // optional bytes entry_key = 2; 575 public boolean hasEntryKey() { 576 return bean().hasEntryKey(); 577 } 578 579 public org.fusesource.hawtbuf.Buffer getEntryKey() { 580 return bean().getEntryKey(); 581 } 582 583 // optional int64 value_location = 3; 584 public boolean hasValueLocation() { 585 return bean().hasValueLocation(); 586 } 587 588 public long getValueLocation() { 589 return bean().getValueLocation(); 590 } 591 592 // optional int32 value_length = 4; 593 public boolean hasValueLength() { 594 return bean().hasValueLength(); 595 } 596 597 public int getValueLength() { 598 return bean().getValueLength(); 599 } 600 601 // optional bytes value = 5; 602 public boolean hasValue() { 603 return bean().hasValue(); 604 } 605 606 public org.fusesource.hawtbuf.Buffer getValue() { 607 return bean().getValue(); 608 } 609 610 // optional bytes meta = 6; 611 public boolean hasMeta() { 612 return bean().hasMeta(); 613 } 614 615 public org.fusesource.hawtbuf.Buffer getMeta() { 616 return bean().getMeta(); 617 } 618 619 public org.fusesource.hawtbuf.Buffer toUnframedBuffer() { 620 if( buffer !=null ) { 621 return buffer; 622 } 623 return org.fusesource.hawtbuf.proto.MessageBufferSupport.toUnframedBuffer(this); 624 } 625 626 public org.fusesource.hawtbuf.Buffer toFramedBuffer() { 627 return org.fusesource.hawtbuf.proto.MessageBufferSupport.toFramedBuffer(this); 628 } 629 630 public byte[] toUnframedByteArray() { 631 return toUnframedBuffer().toByteArray(); 632 } 633 634 public byte[] toFramedByteArray() { 635 return toFramedBuffer().toByteArray(); 636 } 637 638 public void writeFramed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException { 639 output.writeRawVarint32(serializedSizeUnframed()); 640 writeUnframed(output); 641 } 642 643 public void writeFramed(java.io.OutputStream output) throws java.io.IOException { 644 org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output); 645 writeFramed(codedOutput); 646 codedOutput.flush(); 647 } 648 649 public void writeUnframed(java.io.OutputStream output) throws java.io.IOException { 650 org.fusesource.hawtbuf.proto.CodedOutputStream codedOutput = new org.fusesource.hawtbuf.proto.CodedOutputStream(output); 651 writeUnframed(codedOutput); 652 codedOutput.flush(); 653 } 654 655 public void writeUnframed(org.fusesource.hawtbuf.proto.CodedOutputStream output) throws java.io.IOException { 656 if (buffer == null) { 657 int size = serializedSizeUnframed(); 658 buffer = output.getNextBuffer(size); 659 org.fusesource.hawtbuf.proto.CodedOutputStream original=null; 660 if( buffer == null ) { 661 buffer = new org.fusesource.hawtbuf.Buffer(new byte[size]); 662 original = output; 663 output = new org.fusesource.hawtbuf.proto.CodedOutputStream(buffer); 664 } 665 if (bean.hasCollectionKey()) { 666 output.writeInt64(1, bean.getCollectionKey()); 667 } 668 if (bean.hasEntryKey()) { 669 output.writeBytes(2, bean.getEntryKey()); 670 } 671 if (bean.hasValueLocation()) { 672 output.writeInt64(3, bean.getValueLocation()); 673 } 674 if (bean.hasValueLength()) { 675 output.writeInt32(4, bean.getValueLength()); 676 } 677 if (bean.hasValue()) { 678 output.writeBytes(5, bean.getValue()); 679 } 680 if (bean.hasMeta()) { 681 output.writeBytes(6, bean.getMeta()); 682 } 683 if( original !=null ) { 684 output.checkNoSpaceLeft(); 685 output = original; 686 output.writeRawBytes(buffer); 687 } 688 } else { 689 output.writeRawBytes(buffer); 690 } 691 } 692 693 public int serializedSizeFramed() { 694 int t = serializedSizeUnframed(); 695 return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; 696 } 697 698 public int serializedSizeUnframed() { 699 if (buffer != null) { 700 return buffer.length; 701 } 702 if (size != -1) 703 return size; 704 705 size = 0; 706 if (hasCollectionKey()) { 707 size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(1, getCollectionKey()); 708 } 709 if (hasEntryKey()) { 710 size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(2, getEntryKey()); 711 } 712 if (hasValueLocation()) { 713 size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt64Size(3, getValueLocation()); 714 } 715 if (hasValueLength()) { 716 size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeInt32Size(4, getValueLength()); 717 } 718 if (hasValue()) { 719 size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(5, getValue()); 720 } 721 if (hasMeta()) { 722 size += org.fusesource.hawtbuf.proto.CodedOutputStream.computeBytesSize(6, getMeta()); 723 } 724 return size; 725 } 726 727 public boolean equals(Object obj) { 728 if( obj==this ) 729 return true; 730 731 if( obj==null || obj.getClass()!=Buffer.class ) 732 return false; 733 734 return equals((Buffer)obj); 735 } 736 737 public boolean equals(Buffer obj) { 738 return toUnframedBuffer().equals(obj.toUnframedBuffer()); 739 } 740 741 public int hashCode() { 742 if( hashCode==0 ) { 743 hashCode=2000715872 ^ toUnframedBuffer().hashCode(); 744 } 745 return hashCode; 746 } 747 748 public boolean frozen() { 749 return true; 750 } 751 } 752 753} 754