org.allGraphQLCases.client.pojo.Episode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graphql-maven-plugin-samples-allGraphQLCases-pojo-client Show documentation
Show all versions of graphql-maven-plugin-samples-allGraphQLCases-pojo-client Show documentation
This module do integration tests for the generatePojo goal, in client mode
The newest version!
/** Generated by the default template from graphql-java-generator */
package org.allGraphQLCases.client.pojo;
import com.graphql_java_generator.annotation.GraphQLDirective;
import com.graphql_java_generator.annotation.GraphQLEnumType;
/**
*
* @author generated by graphql-java-generator
* @see https://github.com/graphql-java-generator/graphql-java-generator
*/
@GraphQLEnumType("Episode")
@GraphQLDirective(name = "@testDirective", parameterNames = {"aBoolean", "aCustomScalarDate", "anID", "anArray", "anInt", "aFloat", "anObject", "anEnum", "value", "anotherValue"}, parameterTypes = {"Boolean", "Date", "ID", "[String!]", "Int", "Float", "CharacterInput", "Episode", "String!", "String"}, parameterValues = {"true", "2001-02-28", "00000000-0000-0000-0000-000000000002", "[\"str1\",\"str2\"]", "666", "666.666", "{name:\"specific name\",appearsIn:[NEWHOPE,EMPIRE],type:\"Human\"}", "NEWHOPE", "on Enum", "69"})
@GraphQLDirective(name = "@testExtendKeyword", parameterNames = {"msg"}, parameterTypes = {"String"}, parameterValues = {"an Episode extension"})
@SuppressWarnings("unused")
public enum Episode {
NEWHOPE("NEWHOPE"),
@GraphQLDirective(name = "@anotherTestDirective")
EMPIRE("EMPIRE"),
JEDI("JEDI"),
@GraphQLDirective(name = "@testDirective", parameterNames = {"value", "anotherValue"}, parameterTypes = {"String!", "String"}, parameterValues = {"on Enum values", "-1"})
@GraphQLDirective(name = "@anotherTestDirective")
DOES_NOT_EXIST("DOES_NOT_EXIST"),
A_NEW_EPISODE("A_NEW_EPISODE");
// The graphQlValue is needed on server side, to map the enum value to the value defined in the GraphQL schema. They are different
// when the value in the GraphQL schema is a java reserved keyword.
private final String graphQlValue;
/**
* Returns the value of this constant, as specified in the GraphQL schema. This is usually the same as the enum
* item's name. But it will differ if this name is a java reserved keyword (in which case the name is prefixed by an
* underscore)
*
* @return the enum constant with the specified name, as defined in the GraphQL schema
*/
public String graphQlValue() {
return graphQlValue;
}
/**
* Returns the enum constant of this type with the specified name (as specified in the GraphQL schema). The string
* must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters
* are not permitted.)
*
* @param graphQlValue
* The value, as defined in the GraphQL schema. This is usually the same as the enum item's name. But it
* will differ if this name is a java reserved keyword (in which case the name is prefixed by an
* underscore)
* @return the enum constant with the specified name
* @throws IllegalArgumentException
* if this enum type has no constant with the specified GraphQL name
*/
static public Episode fromGraphQlValue(String graphQlValue) {
if (graphQlValue == null) {
return null;
}
for (Episode e : Episode.values()) {
if (e.graphQlValue().equals(graphQlValue)) {
return e;
}
}
throw new IllegalArgumentException("No Episode exists with '" + graphQlValue + "' as a GraphQL value");
}
Episode(String graphQlValue) {
this.graphQlValue = graphQlValue;
}
}