Skip to content

Commit

Permalink
Renaming typealias package so it doesn't require backticks (#114)
Browse files Browse the repository at this point in the history
* Renaming typealias package so it doesn't require backticks

Fixes #113

* Updating wording of deprecation
  • Loading branch information
Kantis authored Feb 27, 2024
1 parent bbb0866 commit 1968dbf
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
44 changes: 44 additions & 0 deletions ks3-jdk/src/jvmMain/kotlin/io/ks3/java/typealias/Typealiases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,49 +26,93 @@ import java.time.YearMonth
import java.util.UUID

// -- IO --
@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("FileAsString", "io.ks3.java.typealiases.FileAsString"),
)
typealias FileAsString =
@Serializable(with = FilePathSerializer::class)
File

// -- NET --
@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("UrlAsString", "io.ks3.java.typealiases.UrlAsString"),
)
typealias UrlAsString =
@Serializable(with = UrlSerializer::class)
URL

@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("UriAsString", "io.ks3.java.typealiases.UriAsString"),
)
typealias UriAsString =
@Serializable(with = UriSerializer::class)
URI

// -- TIME --
@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("YearMonthAsString", "io.ks3.java.typealiases.YearMonthAsString"),
)
typealias YearMonthAsString =
@Serializable(with = YearMonthAsStringSerializer::class)
YearMonth

@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("InstantAsString", "io.ks3.java.typealiases.InstantAsString"),
)
typealias InstantAsString =
@Serializable(with = InstantAsStringSerializer::class)
Instant

@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("InstantAsLong", "io.ks3.java.typealiases.InstantAsLong"),
)
typealias InstantAsLong =
@Serializable(with = InstantAsLongSerializer::class)
Instant

@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("LocalDateAsString", "io.ks3.java.typealiases.LocalDateAsString"),
)
typealias LocalDateAsString =
@Serializable(with = LocalDateAsStringSerializer::class)
LocalDate

@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("LocalDateTimeAsString", "io.ks3.java.typealiases.LocalDateTimeAsString"),
)
typealias LocalDateTimeAsString =
@Serializable(with = LocalDateTimeAsStringSerializer::class)
LocalDateTime

@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("LocalTimeAsString", "io.ks3.java.typealiases.LocalTimeAsString"),
)
typealias LocalTimeAsString =
@Serializable(with = LocalTimeAsStringSerializer::class)
LocalTime

@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("OffsetDateTimeAsString", "io.ks3.java.typealiases.OffsetDateTimeAsString"),
)
typealias OffsetDateTimeAsString =
@Serializable(with = OffsetDateTimeAsStringSerializer::class)
OffsetDateTime

// -- UTIL --
@Deprecated(
"Changed package to io.ks3.java.typealiases to avoid need for backticks in imports. This package will be removed in 1.0",
ReplaceWith("UuidAsString", "io.ks3.java.typealiases.UuidAsString"),
)
typealias UuidAsString =
@Serializable(with = UuidSerializer::class)
UUID
74 changes: 74 additions & 0 deletions ks3-jdk/src/jvmMain/kotlin/io/ks3/java/typealiases/Typealiases.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@file:Suppress("unused")

package io.ks3.java.typealiases

import io.ks3.java.io.FilePathSerializer
import io.ks3.java.net.UriSerializer
import io.ks3.java.net.UrlSerializer
import io.ks3.java.time.InstantAsLongSerializer
import io.ks3.java.time.InstantAsStringSerializer
import io.ks3.java.time.LocalDateAsStringSerializer
import io.ks3.java.time.LocalDateTimeAsStringSerializer
import io.ks3.java.time.LocalTimeAsStringSerializer
import io.ks3.java.time.OffsetDateTimeAsStringSerializer
import io.ks3.java.time.YearMonthAsStringSerializer
import io.ks3.java.util.UuidSerializer
import kotlinx.serialization.Serializable
import java.io.File
import java.net.URI
import java.net.URL
import java.time.Instant
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.OffsetDateTime
import java.time.YearMonth
import java.util.UUID

// -- IO --
typealias FileAsString =
@Serializable(with = FilePathSerializer::class)
File

// -- NET --
typealias UrlAsString =
@Serializable(with = UrlSerializer::class)
URL

typealias UriAsString =
@Serializable(with = UriSerializer::class)
URI

// -- TIME --
typealias YearMonthAsString =
@Serializable(with = YearMonthAsStringSerializer::class)
YearMonth

typealias InstantAsString =
@Serializable(with = InstantAsStringSerializer::class)
Instant

typealias InstantAsLong =
@Serializable(with = InstantAsLongSerializer::class)
Instant

typealias LocalDateAsString =
@Serializable(with = LocalDateAsStringSerializer::class)
LocalDate

typealias LocalDateTimeAsString =
@Serializable(with = LocalDateTimeAsStringSerializer::class)
LocalDateTime

typealias LocalTimeAsString =
@Serializable(with = LocalTimeAsStringSerializer::class)
LocalTime

typealias OffsetDateTimeAsString =
@Serializable(with = OffsetDateTimeAsStringSerializer::class)
OffsetDateTime

// -- UTIL --
typealias UuidAsString =
@Serializable(with = UuidSerializer::class)
UUID

0 comments on commit 1968dbf

Please sign in to comment.