1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing, software13 * distributed under the License is distributed on an "AS IS" BASIS,14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15 * See the License for the specific language governing permissions and16 * limitations under the License.17 */18package org.apache.giraph.io.gora.generated;
1920/**21 * Example class for defining a Giraph-Edge.22 */23 @SuppressWarnings("all")
24publicclassGEdgeextends org.apache.gora.persistency.impl.PersistentBase
25implements org.apache.avro.specific.SpecificRecord,
26 org.apache.gora.persistency.Persistent {
2728/**29 * Schema used for the class.30 */31publicstaticfinal org.apache.avro.Schema SCHEMAS =
32new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\"," +
33"\"name\":\"GEdge\"," +
34"\"namespace\":\"org.apache.giraph.gora.generated\"," +
35"\"fields\":[{\"name\":\"edgeId\",\"type\":\"string\"}," +
36"{\"name\":\"edgeWeight\",\"type\":\"float\"}," +
37"{\"name\":\"vertexInId\",\"type\":\"string\"}," +
38"{\"name\":\"vertexOutId\",\"type\":\"string\"}," +
39"{\"name\":\"label\",\"type\":\"string\"}]}");
4041/** Enum containing all data bean's fields. */42publicstatic enum Field {
43/**44 * Edge id.45 */46 EDGE_ID(0, "edgeId"),
4748/**49 * Edge weight.50 */51 EDGE_WEIGHT(1, "edgeWeight"),
5253/**54 * Edge vertex source id.55 */56 VERTEX_IN_ID(2, "vertexInId"),
5758/**59 * Edge vertex end id.60 */61 VERTEX_OUT_ID(3, "vertexOutId"),
6263/**64 * Edge label.65 */66 LABEL(4, "label");
6768/**69 * Field's index.70 */71privateint index;
7273/**74 * Field's name.75 */76private String name;
7778/**79 * Field's constructor80 * @param index field's index.81 * @param name field's name.82 */83Field(int index, String name) {
84this.index = index;
85this.name = name;
86 }
8788/**89 * Gets field's index.90 * @return int field's index.91 */92publicint getIndex() {
93return index;
94 }
9596/**97 * Gets field's name.98 * @return String field's name.99 */100public String getName() {
101return name;
102 }
103104/**105 * Gets field's attributes to string.106 * @return String field's attributes to string.107 */108public String toString() {
109return name;
110 }
111 };
112113/**114 * Array containing all fields/115 */116privatestaticfinal String[] ALL_FIELDS = {
117"edgeId", "edgeWeight", "vertexInId", "vertexOutId", "label"};
118119/**120 * Tombstone.121 */122privatestaticfinalTombstone TOMBSTONE = newTombstone();
123124/**125 * edgeId.126 */127private java.lang.CharSequence edgeId;
128129/**130 * edgeWeight.131 */132privatefloat edgeWeight;
133134/**135 * vertexInId.136 */137private java.lang.CharSequence vertexInId;
138139/**140 * vertexOutId.141 */142private java.lang.CharSequence vertexOutId;
143144/**145 * label.146 */147private java.lang.CharSequence label;
148149/**150 * Gets the total field count.151 * @return int field count152 */153publicint getFieldsCount() {
154return GEdge.ALL_FIELDS.length;
155 }
156157/**158 * Gets the schema159 * @return Schema160 */161public org.apache.avro.Schema getSchema() {
162return SCHEMAS;
163 }
164165/**166 * Gets field167 * @param field index field.168 * @return Object from an index.169 */170public java.lang.Object get(int field) {
171switch (field) {
172case 0:
173return edgeId;
174case 1:
175return edgeWeight;
176case 2:
177return vertexInId;
178case 3:
179return vertexOutId;
180case 4:
181return label;
182default:
183thrownew org.apache.avro.AvroRuntimeException("Bad index");
184 }
185 }
186187/**188 * Puts a value into a field.189 * @param field index of field used.190 * @param value value of field used.191 */192 @SuppressWarnings(value = "unchecked")
193publicvoid put(int field, java.lang.Object value) {
194switch (field) {
195case 0:
196 edgeId = (java.lang.CharSequence) value;
197break;
198case 1:
199 edgeWeight = (java.lang.Float) value;
200break;
201case 2:
202 vertexInId = (java.lang.CharSequence) value;
203break;
204case 3:
205 vertexOutId = (java.lang.CharSequence) value;
206break;
207case 4:
208 label = (java.lang.CharSequence) value;
209break;
210default:
211thrownew org.apache.avro.AvroRuntimeException("Bad index");
212 }
213 }
214215/**216 * Gets the value of the 'edgeId' field.217 * @return CharSequence.218 */219public java.lang.CharSequence getEdgeId() {
220return edgeId;
221 }
222223/**224 * Sets the value of the 'edgeId' field.225 * @param value the value to set.226 */227publicvoid setEdgeId(java.lang.CharSequence value) {
228this.edgeId = value;
229 setDirty(0);
230 }
231232/**233 * Checks the dirty status of the 'edgeId' field. A field is dirty if it234 * represents a change that has not yet been written to the database.235 * @param value the value to set.236 * @return boolean237 */238publicboolean isEdgeIdDirty(java.lang.CharSequence value) {
239return isDirty(0);
240 }
241242/**243 * Gets the value of the 'edgeWeight' field.244 * @return Float245 */246public java.lang.Float getEdgeWeight() {
247return edgeWeight;
248 }
249250/**251 * Sets the value of the 'edgeWeight' field.252 * @param value the value to set.253 */254publicvoid setEdgeWeight(java.lang.Float value) {
255this.edgeWeight = value;
256 setDirty(1);
257 }
258259/**260 * Checks the dirty status of the 'edgeWeight' field. A field is dirty if it261 * represents a change that has not yet been written to the database.262 * @param value the value to set.263 * @return boolean264 */265publicboolean isEdgeWeightDirty(java.lang.Float value) {
266return isDirty(1);
267 }
268269/**270 * Gets the value of the 'vertexInId' field.271 * @return CharSequence272 */273public java.lang.CharSequence getVertexInId() {
274return vertexInId;
275 }
276277/**278 * Sets the value of the 'vertexInId' field.279 * @param value the value to set.280 */281publicvoid setVertexInId(java.lang.CharSequence value) {
282this.vertexInId = value;
283 setDirty(2);
284 }
285286/**287 * Checks the dirty status of the 'vertexInId' field. A field is dirty if it288 * represents a change that has not yet been written to the database.289 * @param value the value to set.290 * @return boolean291 */292publicboolean isVertexInIdDirty(java.lang.CharSequence value) {
293return isDirty(2);
294 }
295296/**297 * Gets the value of the 'vertexOutId' field.298 * @return CharSequence299 */300public java.lang.CharSequence getVertexOutId() {
301return vertexOutId;
302 }
303304/**305 * Sets the value of the 'vertexOutId' field.306 * @param value the value to set.307 */308publicvoid setVertexOutId(java.lang.CharSequence value) {
309this.vertexOutId = value;
310 setDirty(3);
311 }
312313/**314 * Checks the dirty status of the 'vertexOutId' field. A field is dirty if it315 * represents a change that has not yet been written to the database.316 * @param value the value to set.317 * @return boolean318 */319publicboolean isVertexOutIdDirty(java.lang.CharSequence value) {
320return isDirty(3);
321 }
322323/**324 * Gets the value of the 'label' field.325 * @return CharSequence326 */327public java.lang.CharSequence getLabel() {
328return label;
329 }
330331/**332 * Sets the value of the 'label' field.333 * @param value the value to set.334 */335publicvoid setLabel(java.lang.CharSequence value) {
336this.label = value;
337 setDirty(4);
338 }
339340/**341 * Checks the dirty status of the 'label' field. A field is dirty if it342 * represents a change that has not yet been written to the database.343 * @param value the value to set.344 * @return boolean345 */346publicboolean isLabelDirty(java.lang.CharSequence value) {
347return isDirty(4);
348 }
349350/**351 * Creates a new GEdge RecordBuilder.352 * @return GEdge.Builder353 */354publicstatic org.apache.giraph.io.gora.generated.GEdge.Builder newBuilder() {
355returnnew org.apache.giraph.io.gora.generated.GEdge.Builder();
356 }
357358/**359 * Creates a new GEdge RecordBuilder by copying an existing Builder360 * @param other GEdge.Builder361 * @return org.apache.giraph.io.gora.generated.GEdge.Builder362 */363publicstatic org.apache.giraph.io.gora.generated.GEdge.Builder newBuilder(
364 org.apache.giraph.io.gora.generated.GEdge.Builder other) {
365returnnew org.apache.giraph.io.gora.generated.GEdge.Builder(other);
366 }
367368/**369 * Creates a new GEdge RecordBuilder by copying an existing GEdge instance.370 * @param other GEdge371 * @return org.apache.giraph.io.gora.generated.GEdge.Builder372 */373publicstatic org.apache.giraph.io.gora.generated.GEdge.Builder newBuilder(
374 org.apache.giraph.io.gora.generated.GEdge other) {
375returnnew org.apache.giraph.io.gora.generated.GEdge.Builder(other);
376 }
377378/**379 * Makes a deep copy from a bytebuffer.380 * @param input ByteBuffer381 * @return ByteBuffer382 */383privatestatic java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
384 java.nio.ByteBuffer input) {
385 java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
386int position = input.position();
387 input.reset();
388int mark = input.position();
389int limit = input.limit();
390 input.rewind();
391 input.limit(input.capacity());
392 copy.put(input);
393 input.rewind();
394 copy.rewind();
395 input.position(mark);
396 input.mark();
397 copy.position(mark);
398 copy.mark();
399 input.position(position);
400 copy.position(position);
401 input.limit(limit);
402 copy.limit(limit);
403return copy.asReadOnlyBuffer();
404 }
405406/**407 * RecordBuilder for GEdge instances.408 */409publicstaticclassBuilderextends410 org.apache.avro.specific.SpecificRecordBuilderBase<GEdge> implements411 org.apache.avro.data.RecordBuilder<GEdge> {
412413/**414 * edgeId.415 */416private java.lang.CharSequence edgeId;
417418/**419 * edgeWeight.420 */421privatefloat edgeWeight;
422423/**424 * vertexInId425 */426private java.lang.CharSequence vertexInId;
427428/**429 * vertexOutId.430 */431private java.lang.CharSequence vertexOutId;
432433/**434 * label.435 */436private java.lang.CharSequence label;
437438/**439 * Creates a new Builder440 */441privateBuilder() {
442super(org.apache.giraph.io.gora.generated.GEdge.SCHEMAS);
443 }
444445/**446 * Creates a Builder by copying an existing Builder.447 * @param other GEdge.Builder448 */449privateBuilder(org.apache.giraph.io.gora.generated.GEdge.Builder other) {
450super(other);
451 }
452453/**454 * Creates a Builder by copying an existing GEdge instance.455 * @param other GEdge456 */457// CHECKSTYLE: stop Indentation458privateBuilder(org.apache.giraph.io.gora.generated.GEdge other) {
459super(org.apache.giraph.io.gora.generated.GEdge.SCHEMAS);
460if (isValidValue(fields()[0], other.edgeId)) {
461this.edgeId = (java.lang.CharSequence) data().deepCopy(
462 fields()[0].schema(), other.edgeId);
463 fieldSetFlags()[0] = true;
464 }
465if (isValidValue(fields()[1], other.edgeWeight)) {
466this.edgeWeight = (java.lang.Float) data().deepCopy(
467 fields()[1].schema(), other.edgeWeight);
468 fieldSetFlags()[1] = true;
469 }
470if (isValidValue(fields()[2], other.vertexInId)) {
471this.vertexInId = (java.lang.CharSequence) data().deepCopy(
472 fields()[2].schema(), other.vertexInId);
473 fieldSetFlags()[2] = true;
474 }
475if (isValidValue(fields()[3], other.vertexOutId)) {
476this.vertexOutId = (java.lang.CharSequence) data().deepCopy(
477 fields()[3].schema(), other.vertexOutId);
478 fieldSetFlags()[3] = true;
479 }
480if (isValidValue(fields()[4], other.label)) {
481this.label = (java.lang.CharSequence) data().deepCopy(
482 fields()[4].schema(), other.label);
483 fieldSetFlags()[4] = true;
484 }
485 }
486// CHECKSTYLE: resume Indentation487488/**489 * Gets the value of the 'edgeId' field490 * @return CharSequence491 */492public java.lang.CharSequence getEdgeId() {
493return edgeId;
494 }
495496/**497 * Sets the value of the 'edgeId' field498 * @param value CharSequence499 * @return GEdge.Builder500 */501// CHECKSTYLE: stop Indentation502public org.apache.giraph.io.gora.generated.GEdge.Builder setEdgeId(
503 java.lang.CharSequence value) {
504 validate(fields()[0], value);
505this.edgeId = value;
506 fieldSetFlags()[0] = true;
507returnthis;
508 }
509// CHECKSTYLE: resume Indentation510511/**512 * Checks whether the 'edgeId' field has been set.513 * @return boolean.514 */515publicboolean hasEdgeId() {
516return fieldSetFlags()[0];
517 }
518519/**520 * Clears the value of the 'edgeId' field.521 * @return GEdge.Builder522 */523// CHECKSTYLE: stop Indentation524public org.apache.giraph.io.gora.generated.GEdge.Builder clearEdgeId() {
525 edgeId = null;
526 fieldSetFlags()[0] = false;
527returnthis;
528 }
529// CHECKSTYLE: resume Indentation530531/**532 * Gets the value of the 'edgeWeight' field.533 * @return Float534 */535public java.lang.Float getEdgeWeight() {
536return edgeWeight;
537 }
538539/**540 * Sets the value of the 'edgeWeight' field541 * @param value float542 * @return GEdge.Builder543 */544// CHECKSTYLE: stop Indentation545public org.apache.giraph.io.gora.generated.GEdge.Builder setEdgeWeight(
546float value) {
547 validate(fields()[1], value);
548this.edgeWeight = value;
549 fieldSetFlags()[1] = true;
550returnthis;
551 }
552// CHECKSTYLE: resume Indentation553554/**555 * Checks whether the 'edgeWeight' field has been set.556 * @return boolean557 */558publicboolean hasEdgeWeight() {
559return fieldSetFlags()[1];
560 }
561562/**563 * Clears the value of the 'edgeWeight' field.564 * @return GEdge.Builder565 */566// CHECKSTYLE: stop Indentation567public org.apache.giraph.io.gora.generated.GEdge.Builder clearEdgeWeight() {
568 fieldSetFlags()[1] = false;
569returnthis;
570 }
571// CHECKSTYLE: resume Indentation572573/**574 * Gets the value of the 'vertexInId' field575 * @return CharSequence576 */577public java.lang.CharSequence getVertexInId() {
578return vertexInId;
579 }
580581/**582 * Sets the value of the 'vertexInId' field.583 * @param value CharSequence584 * @return value585 */586// CHECKSTYLE: stop Indentation587public org.apache.giraph.io.gora.generated.GEdge.Builder setVertexInId(
588 java.lang.CharSequence value) {
589 validate(fields()[2], value);
590this.vertexInId = value;
591 fieldSetFlags()[2] = true;
592returnthis;
593 }
594// CHECKSTYLE: resume Indentation595596/**597 * Checks whether the 'vertexInId' field has been set.598 * @return boolean599 */600publicboolean hasVertexInId() {
601return fieldSetFlags()[2];
602 }
603604/**605 * Clears the value of the 'vertexInId' field.606 * @return GEdge.Builder607 */608// CHECKSTYLE: stop Indentation609public org.apache.giraph.io.gora.generated.GEdge.Builder
610 clearVertexInId() {
611 vertexInId = null;
612 fieldSetFlags()[2] = false;
613returnthis;
614 }
615// CHECKSTYLE: resume Indentation616617/**618 * Gets the value of the 'vertexOutId' field.619 * @return java.lang.CharSequence620 */621public java.lang.CharSequence getVertexOutId() {
622return vertexOutId;
623 }
624625/**626 * Sets the value of the 'vertexOutId' field.627 * @param value CharSequence628 * @return GEdge.Builder629 */630// CHECKSTYLE: stop Indentation631public org.apache.giraph.io.gora.generated.GEdge.Builder setVertexOutId(
632 java.lang.CharSequence value) {
633 validate(fields()[3], value);
634this.vertexOutId = value;
635 fieldSetFlags()[3] = true;
636returnthis;
637 }
638// CHECKSTYLE: resume Indentation639640/**641 * Checks whether the 'vertexOutId' field has been set.642 * @return boolean643 */644publicboolean hasVertexOutId() {
645return fieldSetFlags()[3];
646 }
647648/**649 * Clears the value of the 'vertexOutId' field.650 * @return GEdge.Builder651 */652// CHECKSTYLE: stop Indentation653public org.apache.giraph.io.gora.generated.GEdge.Builder
654 clearVertexOutId() {
655 vertexOutId = null;
656 fieldSetFlags()[3] = false;
657returnthis;
658 }
659// CHECKSTYLE: resume Indentation660661/**662 * Gets the value of the 'label' field.663 * @return CharSequence664 */665public java.lang.CharSequence getLabel() {
666return label;
667 }
668669/**670 * Sets the value of the 'label' field.671 * @param value CharSequence672 * @return GEdge.Builder673 */674// CHECKSTYLE: stop Indentation675public org.apache.giraph.io.gora.generated.GEdge.Builder setLabel(
676 java.lang.CharSequence value) {
677 validate(fields()[4], value);
678this.label = value;
679 fieldSetFlags()[4] = true;
680returnthis;
681 }
682// CHECKSTYLE: resume Indentation683684/**685 * Checks whether the 'label' field has been set.686 * @return boolean687 */688publicboolean hasLabel() {
689return fieldSetFlags()[4];
690 }
691692/**693 * Clears the value of the 'label' field.694 * @return GEdge.Builder695 */696// CHECKSTYLE: stop Indentation697public org.apache.giraph.io.gora.generated.GEdge.Builder clearLabel() {
698 label = null;
699 fieldSetFlags()[4] = false;
700returnthis;
701 }
702// CHECKSTYLE: resume Indentation703704 @Override
705/**706 * Builds a GEdge.707 * @return GEdge708 */709// CHECKSTYLE: stop IllegalCatch710publicGEdge build() {
711try {
712GEdge record = newGEdge();
713 record.edgeId = fieldSetFlags()[0] ? this.edgeId :
714 (java.lang.CharSequence) defaultValue(fields()[0]);
715 record.edgeWeight = fieldSetFlags()[1] ? this.edgeWeight :
716 (java.lang.Float) defaultValue(fields()[1]);
717 record.vertexInId = fieldSetFlags()[2] ? this.vertexInId :
718 (java.lang.CharSequence) defaultValue(fields()[2]);
719 record.vertexOutId = fieldSetFlags()[3] ? this.vertexOutId :
720 (java.lang.CharSequence) defaultValue(fields()[3]);
721 record.label = fieldSetFlags()[4] ? this.label :
722 (java.lang.CharSequence) defaultValue(fields()[4]);
723return record;
724 } catch (Exception e) {
725thrownew org.apache.avro.AvroRuntimeException(e);
726 }
727 }
728// CHECKSTYLE: resume IllegalCatch729 }
730731/**732 * Gets a tombstone733 * @return GEdge.Tombstone734 */735public GEdge.Tombstone getTombstone() {
736return TOMBSTONE;
737 }
738739/**740 * Gets a new instance741 * @return GEdge.742 */743publicGEdge newInstance() {
744return newBuilder().build();
745 }
746747/**748 * Tombstone class.749 */750publicstaticfinalclassTombstoneextendsGEdgeimplements751 org.apache.gora.persistency.Tombstone {
752753/**754 * Default constructor.755 */756privateTombstone() {
757 }
758759/**760 * Gets the value of the 'edgeId' field.761 * @return java.lang.CharSequence762 */763public java.lang.CharSequence getEdgeId() {
764thrownew java.lang.UnsupportedOperationException(
765"Get is not supported on tombstones");
766 }
767768/**769 * Sets the value of the 'edgeId' field.770 * @param value the value to set.771 */772publicvoid setEdgeId(java.lang.CharSequence value) {
773thrownew java.lang.UnsupportedOperationException(
774"Set is not supported on tombstones");
775 }
776777/**778 * Checks the dirty status of the 'edgeId' field. A field is dirty if it779 * represents a change that has not yet been written to the database.780 * @param value the value to set.781 * @return boolean782 */783publicboolean isEdgeIdDirty(java.lang.CharSequence value) {
784thrownew java.lang.UnsupportedOperationException(
785"IsDirty is not supported on tombstones");
786 }
787788/**789 * Gets the value of the 'edgeWeight' field.790 * @return Float791 */792public java.lang.Float getEdgeWeight() {
793thrownew java.lang.UnsupportedOperationException(
794"Get is not supported on tombstones");
795 }
796797/**798 * Sets the value of the 'edgeWeight' field.799 * @param value the value to set.800 */801publicvoid setEdgeWeight(java.lang.Float value) {
802thrownew java.lang.UnsupportedOperationException(
803"Set is not supported on tombstones");
804 }
805806/**807 * Checks the dirty status of the 'edgeWeight' field. A field is dirty if it808 * represents a change that has not yet been written to the database.809 * @param value the value to set.810 * @return boolean811 */812publicboolean isEdgeWeightDirty(java.lang.Float value) {
813thrownew java.lang.UnsupportedOperationException(
814"IsDirty is not supported on tombstones");
815 }
816817/**818 * Gets the value of the 'vertexInId' field.819 * @return CharSequence820 */821public java.lang.CharSequence getVertexInId() {
822thrownew java.lang.UnsupportedOperationException(
823"Get is not supported on tombstones");
824 }
825826/**827 * Sets the value of the 'vertexInId' field.828 * @param value the value to set.829 */830publicvoid setVertexInId(java.lang.CharSequence value) {
831thrownew java.lang.UnsupportedOperationException(
832"Set is not supported on tombstones");
833 }
834835/**836 * Checks the dirty status of the 'vertexInId' field. A field is dirty if it837 * represents a change that has not yet been written to the database.838 * @param value the value to set.839 * @return boolean840 */841publicboolean isVertexInIdDirty(java.lang.CharSequence value) {
842thrownew java.lang.UnsupportedOperationException(
843"IsDirty is not supported on tombstones");
844 }
845846/**847 * Gets the value of the 'vertexOutId' field.848 * @return CharSequence849 */850public java.lang.CharSequence getVertexOutId() {
851thrownew java.lang.UnsupportedOperationException(
852"Get is not supported on tombstones");
853 }
854855/**856 * Sets the value of the 'vertexOutId' field.857 * @param value the value to set.858 */859publicvoid setVertexOutId(java.lang.CharSequence value) {
860thrownew java.lang.UnsupportedOperationException(
861"Set is not supported on tombstones");
862 }
863864/**865 * Checks the dirty status of the 'vertexOutId' field. A field is dirty if866 * it represents a change that has not yet been written to the database.867 * @param value the value to set.868 * @return boolean869 */870publicboolean isVertexOutIdDirty(java.lang.CharSequence value) {
871thrownew java.lang.UnsupportedOperationException(
872"IsDirty is not supported on tombstones");
873 }
874875/**876 * Gets the value of the 'label' field.877 * @return CharSequence878 */879public java.lang.CharSequence getLabel() {
880thrownew java.lang.UnsupportedOperationException(
881"Get is not supported on tombstones");
882 }
883884/**885 * Sets the value of the 'label' field.886 * @param value the value to set.887 */888publicvoid setLabel(java.lang.CharSequence value) {
889thrownew java.lang.UnsupportedOperationException(
890"Set is not supported on tombstones");
891 }
892893/**894 * Checks the dirty status of the 'label' field. A field is dirty if it895 * represents a change that has not yet been written to the database.896 * @param value the value to set.897 * @return boolean898 */899publicboolean isLabelDirty(java.lang.CharSequence value) {
900thrownew java.lang.UnsupportedOperationException(
901"IsDirty is not supported on tombstones");
902 }
903 }
904 }