generateDataClasses

fun <T> DataFrame<T>.generateDataClasses(markerName: String, extensionProperties: Boolean = false, visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, useFqNames: Boolean = false, nameNormalizer: NameNormalizer = NameNormalizer.default, nestedMarkerNameProvider: MarkerNameProvider = MarkerNameProvider.fromColumnName): CodeString
inline fun <reified T> DataFrame<T>.generateDataClasses(extensionProperties: Boolean = false, visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, useFqNames: Boolean = false, nameNormalizer: NameNormalizer = NameNormalizer.default, nestedMarkerNameProvider: MarkerNameProvider = MarkerNameProvider.fromColumnName): CodeString

Generates a CodeString containing generated @DataSchema data classes for the given DataFrame's schema (including all nested frame columns and column groups).

These generated declarations can also be called "markers".

This is useful when you want to:

  • Work with the data as regular Kotlin data classes.

  • Convert a dataframe to instantiated data classes with df.toListOf<DataClassType>().

  • Work with data classes serialization.

  • Extract structured types for further use in your application.

This function is a simplified wrapper for the more advanced and customizable CodeGenerator API. For more customizability, have a look at CodeGenerator.create().

For more information: See Data Schemas/Data Classes Generation on the documentation website.

Return

CodeString – A value class wrapper for String, containing the generated Kotlin code of data schema declarations (markers).

Parameters

markerName

The base name to use for generated data schema declarations (markers). If not specified, it generates a name from type T.

extensionProperties

Whether to generate extension properties (column accessors) in addition to data schema declarations (markers). Useful if you don't use the compiler plugin, otherwise they are not needed; the compiler plugin, notebooks, and older Gradle/KSP plugin generate them automatically. Default is false.

visibility

Visibility modifier for the generated declarations (markers). Default is MarkerVisibility.IMPLICIT_PUBLIC.

useFqNames

If true, fully qualified type names will be used in generated code. Default is false.

nameNormalizer

Strategy for converting column names (with spaces, underscores, etc.) to Kotlin-style identifiers. Generated properties will still refer to columns by their actual name using the @ColumnName annotation. Default is NameNormalizer.default.

nestedMarkerNameProvider

Strategy for generating names for nested data schema declarations (markers).


@JvmName(name = "generateDataClassesForSchema")
fun DataFrameSchema.generateDataClasses(markerName: String, extensionProperties: Boolean = false, visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, useFqNames: Boolean = false, nameNormalizer: NameNormalizer = NameNormalizer.default, nestedMarkerNameProvider: MarkerNameProvider = MarkerNameProvider.fromColumnName): CodeString

Generates a CodeString containing generated @DataSchema data classes for the given DataFrameSchema (including all nested frame columns and column groups).

These generated declarations can also be called "markers".

This is useful when you want to:

  • Work with the data as regular Kotlin data classes.

  • Convert a dataframe to instantiated data classes with df.toListOf<DataClassType>().

  • Work with data classes serialization.

  • Extract structured types for further use in your application.

This function is a simplified wrapper for the more advanced and customizable CodeGenerator API. For more customizability, have a look at CodeGenerator.create().

For more information: See Data Schemas/Data Classes Generation on the documentation website.

Return

CodeString – A value class wrapper for String, containing the generated Kotlin code of data schema declarations (markers).

Parameters

markerName

The base name to use for generated data schema declarations (markers).

extensionProperties

Whether to generate extension properties (column accessors) in addition to data schema declarations (markers). Useful if you don't use the compiler plugin, otherwise they are not needed; the compiler plugin, notebooks, and older Gradle/KSP plugin generate them automatically. Default is false.

visibility

Visibility modifier for the generated declarations (markers). Default is MarkerVisibility.IMPLICIT_PUBLIC.

useFqNames

If true, fully qualified type names will be used in generated code. Default is false.

nameNormalizer

Strategy for converting column names (with spaces, underscores, etc.) to Kotlin-style identifiers. Generated properties will still refer to columns by their actual name using the @ColumnName annotation. Default is NameNormalizer.default.

nestedMarkerNameProvider

Strategy for generating names for nested data schema declarations (markers).