use of graphql.schema.GraphQLNamedOutputType in project graphql-java by graphql-java.
the class SchemaUtil method groupInterfaceImplementationsByName.
public static ImmutableMap<String, List<GraphQLObjectType>> groupInterfaceImplementationsByName(List<GraphQLNamedType> allTypesAsList) {
Map<String, List<GraphQLObjectType>> result = new LinkedHashMap<>();
for (GraphQLType type : allTypesAsList) {
if (type instanceof GraphQLObjectType) {
List<GraphQLNamedOutputType> interfaces = ((GraphQLObjectType) type).getInterfaces();
for (GraphQLNamedOutputType interfaceType : interfaces) {
List<GraphQLObjectType> myGroup = result.computeIfAbsent(interfaceType.getName(), k -> new ArrayList<>());
myGroup.add((GraphQLObjectType) type);
}
}
}
return ImmutableMap.copyOf(new TreeMap<>(result));
}
Aggregations