Skip to content

* do not try to expose private final constants #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public GraphQLFieldDefinition getFieldDefinition(DfsContext dfsContext, Class<?>
.deprecate(resolvableTypeAccessor.getGraphQLDeprecationReason())
.description(resolvableTypeAccessor.getDescription());

boolean isConstant = Modifier.isFinal(field.getModifiers()) && Modifier.isStatic(field.getModifiers());
boolean isConstant = isPublicConstant(field);
if (isConstant) {
graphQLFieldDefinitionBuilder.staticValue(org.springframework.util.ReflectionUtils.getField(field, null));
}
Expand All @@ -299,6 +299,13 @@ public GraphQLFieldDefinition getFieldDefinition(DfsContext dfsContext, Class<?>
return graphQLFieldDefinition;
}

private boolean isPublicConstant(Field field) {
int modifiers = field.getModifiers();
return Modifier.isFinal(modifiers)
&& Modifier.isStatic(modifiers)
&& !Modifier.isPrivate(modifiers);
}

public void addToFieldDefinitionResolverMap(DfsContext dfsContext, GraphQLFieldDefinition graphQLFieldDefinition, String complexitySpelExpression) {
fieldDefinitionResolverMap.put(graphQLFieldDefinition,
new GraphQLFieldDefinitionWrapper(graphQLFieldDefinition, complexitySpelExpression));
Expand Down