/** * Convert the given string into the type of the given field, and set the value for that field. A String can be * converted to a boolean, int, long, float, double, bytes, string, or null. * * @param fieldName name of the field to set * @param strVal string value for the field * @return this builder * @throws UnexpectedFormatException if the field is not in the schema, or the field is not nullable but a null * value is given, or the string cannot be converted to the type for the field */ public Builder convertAndSet(String fieldName, @Nullable String strVal) throws UnexpectedFormatException { Schema.Field field = validateAndGetField(fieldName, strVal); fields.put(fieldName, convertString(field.getSchema(), strVal)); return this; }
/** * Convert the given string into the type of the given field, and set the value for that field. A String can be * converted to a boolean, int, long, float, double, bytes, string, or null. * * @param fieldName name of the field to set * @param strVal string value for the field * @return this builder * @throws UnexpectedFormatException if the field is not in the schema, or the field is not nullable but a null * value is given, or the string cannot be converted to the type for the field */ public Builder convertAndSet(String fieldName, @Nullable String strVal) throws UnexpectedFormatException { Schema.Field field = validateAndGetField(fieldName, strVal); fields.put(fieldName, convertString(field.getSchema(), strVal)); return this; }