All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.DirectivesUtil Maven / Gradle / Ivy

There is a newer version: 230521-nf-execution
Show newest version
package graphql;

import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLDirective;
import graphql.util.FpKit;

import java.util.List;
import java.util.Map;
import java.util.Optional;

@Internal
public class DirectivesUtil {

    public static Map directivesByName(List directiveList) {
        return FpKit.getByName(directiveList, GraphQLDirective::getName, FpKit.mergeFirst());
    }

    public static Optional directiveWithArg(List directiveList, String directiveName, String argumentName) {
        GraphQLDirective directive = directivesByName(directiveList).get(directiveName);
        GraphQLArgument argument = null;
        if (directive != null) {
            argument = directive.getArgument(argumentName);
        }
        return Optional.ofNullable(argument);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy