/** * Creates a Builder by copying an existing Builder. * @param other The existing Builder to copy. */ private Builder(example.avro.User.Builder other) { super(other); if (isValidValue(fields()[0], other.name)) { this.name = data().deepCopy(fields()[0].schema(), other.name); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.favoriteNumber)) { this.favoriteNumber = data().deepCopy(fields()[1].schema(), other.favoriteNumber); fieldSetFlags()[1] = true; } if (isValidValue(fields()[2], other.favoriteColor)) { this.favoriteColor = data().deepCopy(fields()[2].schema(), other.favoriteColor); fieldSetFlags()[2] = true; } if (isValidValue(fields()[3], other.eventType)) { this.eventType = data().deepCopy(fields()[3].schema(), other.eventType); fieldSetFlags()[3] = true; } }
/** * Creates a Builder by copying an existing User instance * @param other The existing instance to copy. */ private Builder(example.avro.User 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.favoriteNumber)) { this.favoriteNumber = data().deepCopy(fields()[1].schema(), other.favoriteNumber); fieldSetFlags()[1] = true; } if (isValidValue(fields()[2], other.favoriteColor)) { this.favoriteColor = data().deepCopy(fields()[2].schema(), other.favoriteColor); fieldSetFlags()[2] = true; } if (isValidValue(fields()[3], other.eventType)) { this.eventType = data().deepCopy(fields()[3].schema(), other.eventType); fieldSetFlags()[3] = true; } }
@Override @SuppressWarnings("unchecked") public User build() { try { User record = new User(); record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]); record.favoriteNumber = fieldSetFlags()[1] ? this.favoriteNumber : (java.lang.CharSequence) defaultValue(fields()[1]); record.favoriteColor = fieldSetFlags()[2] ? this.favoriteColor : (java.lang.CharSequence) defaultValue(fields()[2]); record.eventType = fieldSetFlags()[3] ? this.eventType : (example.avro.EventType) defaultValue(fields()[3]); return record; } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
/** * Checks whether the 'favorite_color' field has been set. * @return True if the 'favorite_color' field has been set, false otherwise. */ public boolean hasFavoriteColor() { return fieldSetFlags()[2]; }
/** * Clears the value of the 'name' field. * @return This builder. */ public example.avro.User.Builder clearName() { name = null; fieldSetFlags()[0] = false; return this; }
/** * Sets the value of the 'favorite_color' field. * @param value The value of 'favorite_color'. * @return This builder. */ public example.avro.User.Builder setFavoriteColor(java.lang.CharSequence value) { validate(fields()[2], value); this.favorite_color = value; fieldSetFlags()[2] = true; return this; }
/** * Clears the value of the 'favorite_number' field. * @return This builder. */ public example.avro.User.Builder clearFavoriteNumber() { favorite_number = null; fieldSetFlags()[1] = false; return this; }
/** * Sets the value of the 'favorite_number' field. * @param value The value of 'favorite_number'. * @return This builder. */ public example.avro.User.Builder setFavoriteNumber(java.lang.Integer value) { validate(fields()[1], value); this.favorite_number = value; fieldSetFlags()[1] = true; return this; }
/** * Sets the value of the 'eventType' field. * @param value The value of 'eventType'. * @return This builder. */ public example.avro.User.Builder setEventType(example.avro.EventType value) { validate(fields()[3], value); this.eventType = value; fieldSetFlags()[3] = true; return this; }
/** * Sets the value of the 'favoriteNumber' field. * @param value The value of 'favoriteNumber'. * @return This builder. */ public example.avro.User.Builder setFavoriteNumber(java.lang.CharSequence value) { validate(fields()[1], value); this.favoriteNumber = value; fieldSetFlags()[1] = true; return this; }
/** * Clears the value of the 'name' field. * @return This builder. */ public example.avro.User.Builder clearName() { name = null; fieldSetFlags()[0] = false; return this; }
/** * Checks whether the 'name' field has been set. * @return True if the 'name' field has been set, false otherwise. */ public boolean hasName() { return fieldSetFlags()[0]; }
/** * Clears the value of the 'favoriteColor' field. * @return This builder. */ public example.avro.User.Builder clearFavoriteColor() { favoriteColor = null; fieldSetFlags()[2] = false; return this; }
/** * Clears the value of the 'eventType' field. * @return This builder. */ public example.avro.User.Builder clearEventType() { eventType = null; fieldSetFlags()[3] = false; return this; }
/** * Checks whether the 'favoriteColor' field has been set. * @return True if the 'favoriteColor' field has been set, false otherwise. */ public boolean hasFavoriteColor() { return fieldSetFlags()[2]; }
/** * Sets the value of the 'favoriteColor' field. * @param value The value of 'favoriteColor'. * @return This builder. */ public example.avro.User.Builder setFavoriteColor(java.lang.CharSequence value) { validate(fields()[2], value); this.favoriteColor = value; fieldSetFlags()[2] = true; return this; }
/** * Clears the value of the 'favoriteNumber' field. * @return This builder. */ public example.avro.User.Builder clearFavoriteNumber() { favoriteNumber = null; fieldSetFlags()[1] = false; return this; }
/** * Checks whether the 'favoriteNumber' field has been set. * @return True if the 'favoriteNumber' field has been set, false otherwise. */ public boolean hasFavoriteNumber() { return fieldSetFlags()[1]; }
/** * Sets the value of the 'name' field. * @param value The value of 'name'. * @return This builder. */ public example.avro.User.Builder setName(java.lang.CharSequence value) { validate(fields()[0], value); this.name = value; fieldSetFlags()[0] = true; return this; }
/** * Checks whether the 'eventType' field has been set. * @return True if the 'eventType' field has been set, false otherwise. */ public boolean hasEventType() { return fieldSetFlags()[3]; }