-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from jansigi/feature/use-typeconversion-in-sch…
…emas Feature/use typeconversion in schemas
- Loading branch information
Showing
5 changed files
with
119 additions
and
54 deletions.
There are no files selected for viewing
20 changes: 17 additions & 3 deletions
20
crystal-map-api/src/main/java/com/schwarz/crystalapi/schema/CMType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
package com.schwarz.crystalapi.schema | ||
|
||
interface CMType { | ||
import com.schwarz.crystalapi.ITypeConverter | ||
|
||
sealed interface CMType { | ||
val path: String | ||
} | ||
|
||
class CMField<T : Any>(val name: String, override val path: String) : CMType | ||
open class CMJsonField<T>(val name: String, override val path: String) : CMType | ||
|
||
class CMList<T : Any>(val name: String, override val path: String) : CMType | ||
open class CMJsonList<T>(val name: String, override val path: String) : CMType | ||
|
||
class CMObject<out T : Schema>(val element: T, override val path: String) : CMType | ||
|
||
class CMObjectList<out T : Schema>(val element: T, val name: String, override val path: String) : CMType | ||
|
||
class CMConverterField<KotlinType, MapType>( | ||
name: String, | ||
path: String, | ||
val typeConverter: ITypeConverter<KotlinType, MapType> | ||
) : CMJsonField<MapType>(name, path) | ||
|
||
class CMConverterList<KotlinType, MapType>( | ||
name: String, | ||
path: String, | ||
val typeConverter: ITypeConverter<KotlinType, MapType> | ||
) : CMJsonList<MapType>(name, path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters