File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
kgraphql/src/main/kotlin/com/apurebase/kgraphql/schema Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com.apurebase.kgraphql.schema.dsl.types
2
+
3
+
4
+ import com.apurebase.kgraphql.schema.SchemaException
5
+ import com.apurebase.kgraphql.schema.model.ast.ValueNode
6
+ import com.apurebase.kgraphql.schema.scalar.ShortScalarCoercion
7
+ import com.apurebase.kgraphql.schema.scalar.ScalarCoercion
8
+ import kotlin.reflect.KClass
9
+
10
+
11
+ class ShortScalarDSL <T : Any >(kClass : KClass <T >) : ScalarDSL<T, Short>(kClass) {
12
+
13
+ override fun createCoercionFromFunctions (): ScalarCoercion <T , Short > {
14
+ return object : ShortScalarCoercion <T > {
15
+
16
+ val serializeImpl = serialize ? : throw SchemaException (PLEASE_SPECIFY_COERCION )
17
+
18
+ val deserializeImpl = deserialize ? : throw SchemaException (PLEASE_SPECIFY_COERCION )
19
+
20
+ override fun serialize (instance : T ): Short = serializeImpl(instance)
21
+
22
+ override fun deserialize (raw : Short , valueNode : ValueNode ? ): T = deserializeImpl(raw)
23
+ }
24
+ }
25
+
26
+ }
Original file line number Diff line number Diff line change
1
+ package com.apurebase.kgraphql.schema.scalar
2
+
3
+ interface ShortScalarCoercion <T > : ScalarCoercion <T , Short >
You can’t perform that action at this time.
0 commit comments