Skip to content

Commit 0b6e76c

Browse files
committed
feat(graphql-java): Default getter and typeGetter
The default value of getter and typeGetter is an always-throwing lambda instead of the fields being lateinit
1 parent 7069213 commit 0b6e76c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

core/src/main/kotlin/schema/Definitions.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ interface GraphQLMutableFieldDefinition<T : Any, M> :
786786

787787
override val onGetBlocks: MutableList<GraphQLGetterBlock<T, M>> /* = mutableListOf() */
788788
override val onGetBlockingBlocks: MutableList<GraphQLGetterBlockingBlock<T, M>> /* = mutableListOf() */
789-
override /* lateinit */ var getter: GraphQLFlowGetter<T, M>
789+
override var getter: GraphQLFlowGetter<T, M> /* = { throw NotImplementedError() } */
790790
}
791791

792792
/**
@@ -828,7 +828,7 @@ fun <T : Any, M> GraphQLMutableFieldDefinition(): GraphQLMutableFieldDefinition<
828828
override val arguments = mutableListOf<GraphQLArgumentDefinition<*>>()
829829
override val onGetBlocks = mutableListOf<GraphQLGetterBlock<T, M>>()
830830
override val onGetBlockingBlocks = mutableListOf<GraphQLGetterBlockingBlock<T, M>>()
831-
override lateinit var getter: GraphQLFlowGetter<T, M>
831+
override var getter: GraphQLFlowGetter<T, M> = { throw NotImplementedError("Getter of field $name was not implemented.") }
832832
}
833833
}
834834

@@ -1405,7 +1405,7 @@ fun <T : Any> GraphQLMutableInterfaceType(): GraphQLMutableInterfaceType<T> {
14051405
override val onGetBlocks = mutableListOf<GraphQLGetterBlock<T, *>>()
14061406
override val onGetBlockingBlocks = mutableListOf<GraphQLGetterBlockingBlock<T, *>>()
14071407
override val fields = mutableListOf<GraphQLFieldDefinition<T, *>>()
1408-
override lateinit var typeGetter: GraphQLTypeGetter<T>
1408+
override var typeGetter: GraphQLTypeGetter<T> = { throw NotImplementedError("Type getter of interface $name was not implemented.") }
14091409
}
14101410
}
14111411

@@ -2075,7 +2075,7 @@ fun <T : Any> GraphQLMutableUnionType(): GraphQLMutableUnionType<T> {
20752075
override lateinit var name: String
20762076
override var description: String = ""
20772077
override val directives = mutableListOf<GraphQLDirective>()
2078-
override lateinit var typeGetter: GraphQLTypeGetter<T>
2078+
override var typeGetter: GraphQLTypeGetter<T> = { throw NotImplementedError("Type getter of union $name was not implemented.") }
20792079
override val types = mutableListOf<GraphQLObjectType<out T>>()
20802080
}
20812081
}

core/src/main/kotlin/schema/Interfaces.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ interface GraphQLElementWithTypeGetter<T : Any> {
786786
*/
787787
interface GraphQLMutableElementWithTypeGetter<T : Any> :
788788
GraphQLElementWithTypeGetter<T> {
789-
override /* lateinit */ var typeGetter: GraphQLTypeGetter<T>
789+
override var typeGetter: GraphQLTypeGetter<T> /* = { throw NotImplementedError() } */
790790
}
791791

792792
/* ---------------------------------------------- */

0 commit comments

Comments
 (0)