Skip to content

Commit 60d48ac

Browse files
committed
change coerceValue to parseValue (inspired by the js impl)
1 parent f0067be commit 60d48ac

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

src/main/java/graphql/Scalars.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public Object coerce(Object input) {
2424
}
2525

2626
@Override
27-
public Object coerceValue(Object input) {
27+
public Object parseValue(Object input) {
2828
return null;
2929
}
3030

@@ -51,7 +51,7 @@ public Object coerce(Object input) {
5151
}
5252

5353
@Override
54-
public Object coerceValue(Object input) {
54+
public Object parseValue(Object input) {
5555
return null;
5656
}
5757

@@ -75,7 +75,7 @@ public Object coerce(Object input) {
7575
}
7676

7777
@Override
78-
public Object coerceValue(Object input) {
78+
public Object parseValue(Object input) {
7979
return null;
8080
}
8181

@@ -92,7 +92,7 @@ public Object coerce(Object input) {
9292
}
9393

9494
@Override
95-
public Object coerceValue(Object input) {
95+
public Object parseValue(Object input) {
9696
return null;
9797
}
9898

@@ -119,7 +119,7 @@ public Object coerce(Object input) {
119119
}
120120

121121
@Override
122-
public Object coerceValue(Object input) {
122+
public Object parseValue(Object input) {
123123
return null;
124124
}
125125

@@ -142,7 +142,7 @@ public Object coerce(Object input) {
142142
}
143143

144144
@Override
145-
public Object coerceValue(Object input) {
145+
public Object parseValue(Object input) {
146146
return null;
147147
}
148148

src/main/java/graphql/execution/ValuesResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private Object coerceValueForScalar(GraphQLScalarType graphQLScalarType, Object
9393
}
9494

9595
private Object coerceValueForEnum(GraphQLEnumType graphQLEnumType, Object value) {
96-
return graphQLEnumType.getCoercing().coerceValue(value);
96+
return graphQLEnumType.getCoercing().parseValue(value);
9797
}
9898

9999
private List coerceValueForList(GraphQLList graphQLList, Object value) {

src/main/java/graphql/schema/Coercing.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44
public interface Coercing {
55

66

7+
/**
8+
* @param input
9+
* @return
10+
*/
711
Object coerce(Object input);
812

9-
Object coerceValue(Object input);
13+
/**
14+
* Called to resolve a input from a variable.
15+
*
16+
* @param input
17+
* @return
18+
*/
19+
Object parseValue(Object input);
1020

1121
/**
1222
* @param input

src/main/java/graphql/schema/GraphQLEnumType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public Object coerce(Object input) {
2424
}
2525

2626
@Override
27-
public Object coerceValue(Object input) {
27+
public Object parseValue(Object input) {
2828
return getValueByName(input);
2929
}
3030

0 commit comments

Comments
 (0)