Class DefaultGraphqlTypeComparatorRegistry
java.lang.Object
graphql.schema.DefaultGraphqlTypeComparatorRegistry
- All Implemented Interfaces:
GraphqlTypeComparatorRegistry
@PublicApi
public class DefaultGraphqlTypeComparatorRegistry
extends Object
implements GraphqlTypeComparatorRegistry
Associates a
Comparator with a GraphqlTypeComparatorEnvironment to control the scope in which the Comparator can be applied.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<GraphQLSchemaElement> private Map<GraphqlTypeComparatorEnvironment, Comparator<?>> private static final com.google.common.collect.ImmutableMap<Class<? extends GraphQLSchemaElement>, Integer> Fields inherited from interface GraphqlTypeComparatorRegistry
AS_IS_REGISTRY, BY_NAME_REGISTRY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivate -
Method Summary
Modifier and TypeMethodDescriptionprivate static int<T extends GraphQLSchemaElement>
Comparator<? super T> getComparator(GraphqlTypeComparatorEnvironment environment) Search for the most to least specific registeredComparatorotherwise a default is returned.static Comparator<GraphQLSchemaElement> This orders the schema into a sensible grouped orderprivate static GraphQLSchemaElementunwrapElement(GraphQLSchemaElement element)
-
Field Details
-
SENSIBLE_ORDER
private static final com.google.common.collect.ImmutableMap<Class<? extends GraphQLSchemaElement>, Integer> SENSIBLE_ORDER -
DEFAULT_COMPARATOR
-
registry
-
-
Constructor Details
-
DefaultGraphqlTypeComparatorRegistry
private DefaultGraphqlTypeComparatorRegistry() -
DefaultGraphqlTypeComparatorRegistry
private DefaultGraphqlTypeComparatorRegistry(Map<GraphqlTypeComparatorEnvironment, Comparator<?>> registry)
-
-
Method Details
-
sensibleGroupedOrder
This orders the schema into a sensible grouped order- Returns:
- a comparator that allows for sensible grouped order
-
unwrapElement
-
compareByName
-
getComparator
public <T extends GraphQLSchemaElement> Comparator<? super T> getComparator(GraphqlTypeComparatorEnvironment environment) Search for the most to least specific registeredComparatorotherwise a default is returned.- Specified by:
getComparatorin interfaceGraphqlTypeComparatorRegistry- Type Parameters:
T- the type of the comparator- Parameters:
environment- Defines the scope to control where theComparatorcan be applied.- Returns:
- The registered
Comparatorornullif not found.
-
defaultComparators
- Returns:
- A registry where all
GraphQLTypes receive a defaultComparatorby comparingGraphQLType::getName.
-
newComparators
-