Skip to content

Ultra-Fast CSV Deserialization to Data Class based on Code Generations.

License

Notifications You must be signed in to change notification settings

iamriajul/fastcsv-codegen

Repository files navigation

FastCSV-Codegen

Sonatype Nexus (Snapshots) GitHub Workflow Status GitHub issues Star on GitHub GitHub top language Gitpod ready-to-code License: MIT

Ultra-Fast CSV Deserialization to Data Class based on Code Generations.

Uses osiegmar/FastCSV ^1.0.4 to parse CSV which is very fast! and to deserialize your CSV to Data Class it uses code generation via kapt (kotlin annotation processing).

The annotation is @CsvCodegen and it generates file with suffix of CsvCodegen, eg: PostCsvCodegen for you Post data class.

A Data Class Implementing @CsvCodegen annotation.

@CsvCodegen
data class Post(
    val id: Int,
    val title: String,
    val content: String?,
    val a: Char,
    val b: Char?,
    val author_id: Int?,
    val is_public: Boolean,
    val is_updated: Boolean?,
)

Deserializing

val items: List<Post> = PostCsvCodegen.fromCsv(csvString)

Yes! Deserializing is as simple as one line code! You don't write all those boilerplate codes!

It currently support these data types

Int,
IntNullable,
Long,
LongNullable,
Short,
ShortNullable,
Byte,
ByteNullable,
Double,
DoubleNullable,
Float,
FloatNullable,
Boolean,
BooleanNullable,
Char,
CharNullable,
String,
StringNullable

Installation

Add Repository

maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")

Add Dependency

implementation("dev.riajul.fastcsv-codegen:annotations:1.0-alpha-1-SNAPSHOT")
kapt("dev.riajul.fastcsv-codegen:generator:1.0-alpha-1-SNAPSHOT")

About

Ultra-Fast CSV Deserialization to Data Class based on Code Generations.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages