/** * Initialize the format with the given desired schema and properties. * Guaranteed to be called once before any other method is called. * * @param formatSpecification the specification for the format, containing the desired schema and settings * @throws UnsupportedTypeException if the desired schema and properties are not supported */ public void initialize(@Nullable FormatSpecification formatSpecification) throws UnsupportedTypeException { Schema desiredSchema = null; Map<String, String> settings = Collections.emptyMap(); if (formatSpecification != null) { desiredSchema = formatSpecification.getSchema(); settings = formatSpecification.getSettings(); } desiredSchema = desiredSchema == null ? getDefaultSchema() : desiredSchema; if (desiredSchema == null) { String msg = "A schema must be provided to the format: "; if (formatSpecification != null) { msg += formatSpecification.getName(); } throw new UnsupportedTypeException(msg); } validateIsRecord(desiredSchema); validateSchema(desiredSchema); this.schema = desiredSchema; configure(settings); }
/** * Initialize the format with the given desired schema and properties. * Guaranteed to be called once before any other method is called. * * @param formatSpecification the specification for the format, containing the desired schema and settings * @throws UnsupportedTypeException if the desired schema and properties are not supported */ public void initialize(@Nullable FormatSpecification formatSpecification) throws UnsupportedTypeException { Schema desiredSchema = null; Map<String, String> settings = Collections.emptyMap(); if (formatSpecification != null) { desiredSchema = formatSpecification.getSchema(); settings = formatSpecification.getSettings(); } desiredSchema = desiredSchema == null ? getDefaultSchema() : desiredSchema; if (desiredSchema == null) { String msg = "A schema must be provided to the format: "; if (formatSpecification != null) { msg += formatSpecification.getName(); } throw new UnsupportedTypeException(msg); } validateIsRecord(desiredSchema); validateSchema(desiredSchema); this.schema = desiredSchema; configure(settings); }