Skip to content

@Parcelize

The parcelize-extensions artifact provides a set of parcelers for use with the Parcelable implementation generator plugin.

Gradle Setup

dependencies {
    implementation("io.islandtime:parcelize-extensions:0.6.3")
}
dependencies {
    implementation "io.islandtime:parcelize-extensions:0.6.3"
}

Usage

Custom parcelers are available for each of Island Time's date-time primitives, durations, and intervals, allowing you to use them within Parcelable classes.

@Parcelize
@TypeParceler<Date, DateParceler>()
data class MyParcelable(
    val name: String,
    val date: Date
) : Parcelable

In the above example, DateParceler is used to generate a class containing a non-nullable Date. You could make the Date nullable instead by using NullableDateParceler.

@Parcelize
@TypeParceler<Date?, NullableDateParceler>()
data class MyParcelableWithNull(
    val name: String,
    val date: Date?
) : Parcelable

See the Parcelize Extensions API documention for the full list of available parcelers.