/** * Get a builder for creating a record with the given schema. * * @param schema schema for the record to build. * @return builder for creating a record with the given schema. * @throws UnexpectedFormatException if the given schema is not a record with at least one field. */ public static Builder builder(Schema schema) throws UnexpectedFormatException { if (schema == null || schema.getType() != Schema.Type.RECORD || schema.getFields().size() < 1) { throw new UnexpectedFormatException("Schema must be a record with at least one field."); } return new Builder(schema); }
/** * Get a builder for creating a record with the given schema. * * @param schema schema for the record to build. * @return builder for creating a record with the given schema. * @throws UnexpectedFormatException if the given schema is not a record with at least one field. */ public static Builder builder(Schema schema) throws UnexpectedFormatException { if (schema == null || schema.getType() != Schema.Type.RECORD || schema.getFields().size() < 1) { throw new UnexpectedFormatException("Schema must be a record with at least one field."); } return new Builder(schema); }