net.morimekta.providence.graphql.gql.GQLDirective Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of providence-graphql Show documentation
Show all versions of providence-graphql Show documentation
Providence Core extension for GraphQL.
package net.morimekta.providence.graphql.gql;
/**
* A directive represents some modification on a GQL field. It can for
* the most part be handled in-line, as the query and arguments are
* parsed, but may be (some time in the future) required to be kept
* along the field selection.
*/
public enum GQLDirective {
/**
* @include(if: $var)
*
* Include the field only if 'if' resolves to true.
*/
include,
/**
* @include(if: $var)
*
* Include the field only if 'if' resolves to false.
*/
skip,
;
/**
* Find directive by the name, not including the '@'.
*
* @param name The directive name.
* @return The directive, or null if not found.
*/
public static GQLDirective findByName(String name) {
for (GQLDirective directive : values()) {
if (directive.name().equals(name)) {
return directive;
}
}
return null;
}
}