Record Class FormatSpec
java.lang.Object
java.lang.Record
org.elasticsearch.xpack.esql.datasources.spi.FormatSpec
- Record Components:
format- logical format name (e.g. "csv", "tsv", "parquet")extensions- file extensions with leading dot (e.g. ".csv", ".parquet")configKeys- per-dataset configuration keys the format reader recognises
public record FormatSpec(String format, Set<String> extensions, Set<String> configKeys)
extends Record
Describes a file format this plugin provides: a logical format name, the
file extensions that select it, and the per-dataset configuration keys it
recognises.
The format name must match a key in the map returned by
DataSourcePlugin.formatReaders(org.elasticsearch.common.settings.Settings). Multiple extensions may map to the
same format (e.g. .ndjson, .jsonl, .json all select
"ndjson"), but each extension should map to exactly one format across
all plugins.
configKeys declares the configuration keys the format reader
accepts per dataset (e.g. "delimiter", "encoding" for CSV).
These keys must stay in sync with the reader's RECOGNIZED_KEYS;
each format plugin's test suite should verify the symmetry.
Example:
Set.of(
new FormatSpec("csv", Set.of(".csv"), Set.of("delimiter", "quote")),
new FormatSpec("tsv", Set.of(".tsv"), Set.of("delimiter", "quote"))
)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfigKeysrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextensionsrecord component.format()Returns the value of theformatrecord component.final inthashCode()Returns a hash code value for this object.static FormatSpecConvenience factory for formats with no per-dataset configuration keys.static FormatSpecConvenience factory for the common single-extension case with config keys.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FormatSpec
Creates an instance of aFormatSpecrecord class.- Parameters:
format- the value for theformatrecord componentextensions- the value for theextensionsrecord componentconfigKeys- the value for theconfigKeysrecord component
-
-
Method Details
-
of
Convenience factory for formats with no per-dataset configuration keys. -
of
Convenience factory for the common single-extension case with config keys. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
format
Returns the value of theformatrecord component.- Returns:
- the value of the
formatrecord component
-
extensions
Returns the value of theextensionsrecord component.- Returns:
- the value of the
extensionsrecord component
-
configKeys
Returns the value of theconfigKeysrecord component.- Returns:
- the value of the
configKeysrecord component
-