@@ -44,41 +44,6 @@ public class GraphQLEnumType implements GraphQLNamedInputType, GraphQLNamedOutpu
4444 public static final String CHILD_VALUES = "values" ;
4545 public static final String CHILD_DIRECTIVES = "directives" ;
4646
47- private final Coercing coercing = new Coercing () {
48- @ Override
49- public Object serialize (Object input ) {
50- return getNameByValue (input );
51- }
52-
53- @ Override
54- public Object parseValue (Object input ) {
55- return getValueByName (input );
56- }
57-
58- private String typeName (Object input ) {
59- if (input == null ) {
60- return "null" ;
61- }
62- return input .getClass ().getSimpleName ();
63- }
64-
65- @ Override
66- public Object parseLiteral (Object input ) {
67- if (!(input instanceof EnumValue )) {
68- throw new CoercingParseLiteralException (
69- "Expected AST type 'EnumValue' but was '" + typeName (input ) + "'."
70- );
71- }
72- EnumValue enumValue = (EnumValue ) input ;
73- GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap .get (enumValue .getName ());
74- if (enumValueDefinition == null ) {
75- throw new CoercingParseLiteralException (
76- "Expected enum literal value not in allowable values - '" + String .valueOf (input ) + "'."
77- );
78- }
79- return enumValueDefinition .getValue ();
80- }
81- };
8247
8348
8449 /**
@@ -121,6 +86,40 @@ private GraphQLEnumType(String name, String description, List<GraphQLEnumValueDe
12186 buildMap (values );
12287 }
12388
89+ @ Internal
90+ public Object serialize (Object input ) {
91+ return getNameByValue (input );
92+ }
93+
94+ @ Internal
95+ public Object parseValue (Object input ) {
96+ return getValueByName (input );
97+ }
98+
99+ private String typeName (Object input ) {
100+ if (input == null ) {
101+ return "null" ;
102+ }
103+ return input .getClass ().getSimpleName ();
104+ }
105+
106+ @ Internal
107+ public Object parseLiteral (Object input ) {
108+ if (!(input instanceof EnumValue )) {
109+ throw new CoercingParseLiteralException (
110+ "Expected AST type 'EnumValue' but was '" + typeName (input ) + "'."
111+ );
112+ }
113+ EnumValue enumValue = (EnumValue ) input ;
114+ GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap .get (enumValue .getName ());
115+ if (enumValueDefinition == null ) {
116+ throw new CoercingParseLiteralException (
117+ "Expected enum literal value not in allowable values - '" + String .valueOf (input ) + "'."
118+ );
119+ }
120+ return enumValueDefinition .getValue ();
121+ }
122+
124123 public List <GraphQLEnumValueDefinition > getValues () {
125124 return new ArrayList <>(valueDefinitionMap .values ());
126125 }
@@ -182,10 +181,6 @@ public String getDescription() {
182181 return description ;
183182 }
184183
185- public Coercing getCoercing () {
186- return coercing ;
187- }
188-
189184 public EnumTypeDefinition getDefinition () {
190185 return definition ;
191186 }
0 commit comments