/** * Creates a Builder by copying an existing TextStats instance * @param other The existing instance to copy. */ private Builder(org.apache.avro.mapreduce.TextStats other) { super(SCHEMA$); if (isValidValue(fields()[0], other.name)) { this.name = data().deepCopy(fields()[0].schema(), other.name); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.count)) { this.count = data().deepCopy(fields()[1].schema(), other.count); fieldSetFlags()[1] = true; } }
/** * Creates a Builder by copying an existing Builder. * @param other The existing Builder to copy. */ private Builder(org.apache.avro.mapreduce.TextStats.Builder other) { super(other); if (isValidValue(fields()[0], other.name)) { this.name = data().deepCopy(fields()[0].schema(), other.name); fieldSetFlags()[0] = other.fieldSetFlags()[0]; } if (isValidValue(fields()[1], other.count)) { this.count = data().deepCopy(fields()[1].schema(), other.count); fieldSetFlags()[1] = other.fieldSetFlags()[1]; } }
@Override @SuppressWarnings("unchecked") public TextStats build() { try { TextStats record = new TextStats(); record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]); record.count = fieldSetFlags()[1] ? this.count : (java.lang.Integer) defaultValue(fields()[1]); return record; } catch (org.apache.avro.AvroMissingFieldException e) { throw e; } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
/** * Sets the value of the 'count' field. * @param value The value of 'count'. * @return This builder. */ public org.apache.avro.mapreduce.TextStats.Builder setCount(int value) { validate(fields()[1], value); this.count = value; fieldSetFlags()[1] = true; return this; }
/** * Sets the value of the 'name' field. * @param value The value of 'name'. * @return This builder. */ public org.apache.avro.mapreduce.TextStats.Builder setName(java.lang.CharSequence value) { validate(fields()[0], value); this.name = value; fieldSetFlags()[0] = true; return this; }