Skip to content

Commit f17ee9b

Browse files
committed
Convert some interfaces to Kotlin
1 parent dff1423 commit f17ee9b

10 files changed

+45
-61
lines changed
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

3-
import kotlin.coroutines.CoroutineContext;
3+
import kotlin.coroutines.CoroutineContext
44

5-
public interface CoroutineContextProvider {
6-
7-
CoroutineContext provide();
5+
interface CoroutineContextProvider {
6+
fun provide(): CoroutineContext?
87
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

33
/**
44
* @author Andrew Potter
55
*/
6-
public interface GraphQLMutationResolver extends GraphQLResolver<Void> {
7-
8-
}
6+
interface GraphQLMutationResolver : GraphQLResolver<Void?>
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

33
/**
44
* @author Andrew Potter
55
*/
6-
public interface GraphQLQueryResolver extends GraphQLResolver<Void> {
7-
8-
}
6+
interface GraphQLQueryResolver : GraphQLResolver<Void?>
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

33
/**
44
* @author Andrew Potter
55
*/
6-
public interface GraphQLResolver<DataClass> {
7-
8-
}
9-
6+
interface GraphQLResolver<DataClass>
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

3-
public interface GraphQLSubscriptionResolver extends GraphQLResolver<Void> {
4-
5-
}
3+
interface GraphQLSubscriptionResolver : GraphQLResolver<Void?>
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

3-
import com.fasterxml.jackson.databind.ObjectMapper;
3+
import com.fasterxml.jackson.databind.ObjectMapper
44

55
/**
66
* @author Andrew Potter
77
*/
8-
public interface ObjectMapperConfigurer {
9-
10-
void configure(ObjectMapper mapper, ObjectMapperConfigurerContext context);
8+
interface ObjectMapperConfigurer {
9+
fun configure(mapper: ObjectMapper?, context: ObjectMapperConfigurerContext?)
1110
}

src/main/kotlin/graphql/kickstart/tools/ParameterizedTypeImpl.java

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
/**
3737
* Implementing class for ParameterizedType interface.
3838
*/
39-
4039
class ParameterizedTypeImpl implements ParameterizedType {
4140

4241
private final Type[] actualTypeArguments;
@@ -64,20 +63,19 @@ private void validateConstructorArguments() {
6463
}
6564

6665
/**
67-
* Static factory. Given a (generic) class, actual type arguments and an owner type, creates a parameterized type. This class can
68-
* be instantiated with a raw type that does not represent a generic type, provided the list of actual type arguments is empty. If
69-
* the ownerType argument is null, the declaring class of the raw type is used as the owner type.
66+
* Static factory. Given a (generic) class, actual type arguments and an owner type, creates a parameterized type. This
67+
* class can be instantiated with a raw type that does not represent a generic type, provided the list of actual type
68+
* arguments is empty. If the ownerType argument is null, the declaring class of the raw type is used as the owner type.
7069
* <p> This method throws a MalformedParameterizedTypeException
71-
* under the following circumstances: If the number of actual type arguments (i.e., the size of the array {@code typeArgs}) does
72-
* not correspond to the number of formal type arguments. If any of the actual type arguments is not an instance of the bounds on
73-
* the corresponding formal.
70+
* under the following circumstances: If the number of actual type arguments (i.e., the size of the array {@code
71+
* typeArgs}) does not correspond to the number of formal type arguments. If any of the actual type arguments is not an
72+
* instance of the bounds on the corresponding formal.
7473
*
7574
* @param rawType the Class representing the generic type declaration being instantiated
76-
* @param actualTypeArguments a (possibly empty) array of types representing the actual type arguments to the parameterized type
75+
* @param actualTypeArguments a (possibly empty) array of types representing the actual type arguments to the
76+
* parameterized type
7777
* @param ownerType the enclosing type, if known.
78-
*
7978
* @return An instance of {@code ParameterizedType}
80-
*
8179
* @throws MalformedParameterizedTypeException if the instantiation is invalid
8280
*/
8381
public static ParameterizedTypeImpl make(
@@ -92,10 +90,10 @@ public static ParameterizedTypeImpl make(
9290
* if this type represents a non-parameterized type nested within a parameterized type.
9391
*
9492
* @return an array of {@code Type} objects representing the actual type arguments to this type
95-
*
96-
* @throws TypeNotPresentException if any of the actual type arguments refers to a non-existent type declaration
97-
* @throws MalformedParameterizedTypeException if any of the actual type parameters refer to a parameterized type that cannot be
98-
* instantiated for any reason
93+
* @throws TypeNotPresentException if any of the actual type arguments refers to a non-existent type
94+
* declaration
95+
* @throws MalformedParameterizedTypeException if any of the actual type parameters refer to a parameterized type that
96+
* cannot be instantiated for any reason
9997
* @since 1.5
10098
*/
10199
public Type[] getActualTypeArguments() {
@@ -112,16 +110,15 @@ public Class<?> getRawType() {
112110
}
113111

114112
/**
115-
* Returns a {@code Type} object representing the type that this type is a member of. For example, if this type is {@code
116-
* O<T>.I<S>}, return a representation of {@code O<T>}.
113+
* Returns a {@code Type} object representing the type that this type is a member of. For example, if this type is
114+
* {@code O<T>.I<S>}, return a representation of {@code O<T>}.
117115
* <p>If this type is a top-level type, {@code null} is returned.
118116
*
119-
* @return a {@code Type} object representing the type that this type is a member of. If this type is a top-level type, {@code
120-
* null} is returned
121-
*
117+
* @return a {@code Type} object representing the type that this type is a member of. If this type is a top-level type,
118+
* {@code null} is returned
122119
* @throws TypeNotPresentException if the owner type refers to a non-existent type declaration
123-
* @throws MalformedParameterizedTypeException if the owner type refers to a parameterized type that cannot be instantiated for any
124-
* reason
120+
* @throws MalformedParameterizedTypeException if the owner type refers to a parameterized type that cannot be
121+
* instantiated for any reason
125122
*/
126123
public Type getOwnerType() {
127124
return ownerType;
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

3-
import com.fasterxml.jackson.databind.ObjectMapper;
4-
import graphql.language.FieldDefinition;
3+
import com.fasterxml.jackson.databind.ObjectMapper
4+
import graphql.language.FieldDefinition
55

6-
public interface PerFieldObjectMapperProvider {
6+
interface PerFieldObjectMapperProvider {
77

8-
ObjectMapper provide(FieldDefinition fieldDefinition);
8+
fun provide(fieldDefinition: FieldDefinition?): ObjectMapper?
99
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
package graphql.kickstart.tools;
1+
package graphql.kickstart.tools
22

3-
import graphql.language.Definition;
3+
import graphql.language.Definition
44

5-
import java.util.List;
6-
7-
public interface TypeDefinitionFactory {
5+
interface TypeDefinitionFactory {
86

97
/**
108
* Called after parsing the SDL for creating any additional type definitions. All existing definitions are passed in. Return only
@@ -14,5 +12,5 @@ public interface TypeDefinitionFactory {
1412
*
1513
* @return any new definitions that should be added
1614
*/
17-
List<Definition<?>> create(final List<Definition<?>> existing);
15+
fun create(existing: List<Definition<*>?>?): List<Definition<*>?>?
1816
}

src/main/kotlin/graphql/kickstart/tools/directive/SchemaGeneratorDirectiveHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222

2323
/**
24-
* This contains the helper code that allows {@link graphql.schema.idl.SchemaDirectiveWiring} implementations to be invoked during
25-
* schema generation.
24+
* This contains the helper code that allows {@link graphql.schema.idl.SchemaDirectiveWiring} implementations to be invoked
25+
* during schema generation.
2626
*/
2727
@Internal
2828
public class SchemaGeneratorDirectiveHelper {

0 commit comments

Comments
 (0)