private Object parseLiteral(Value inputValue, Coercing coercing, Map<String, Object> variables) { // the CoercingParseLiteralException exception that could happen here has been validated earlier via ValidationUtil return coercing.parseLiteral(inputValue, variables); }
private boolean parseLiteral(Value value, Coercing coercing) { try { return coercing.parseLiteral(value) != null; } catch (CoercingParseLiteralException e) { return false; } }
/** * Called during query execution to convert an query input AST node into a Java object acceptable for the scalar type. The input * object will be an instance of {@link graphql.language.Value}. * * Note : You should not allow {@link java.lang.RuntimeException}s to come out of your parseLiteral method, but rather * catch them and fire them as {@link graphql.schema.CoercingParseLiteralException} instead as per the method contract. * * Many scalar types don't need to implement this method because they do'nt take AST {@link graphql.language.VariableReference} * objects and convert them into actual values. But for those scalar types that want to do this, then this * method should be implemented. * * @param input is never null * @param variables the resolved variables passed to the query * * @return a parsed value which is never null * * @throws graphql.schema.CoercingParseLiteralException if input literal can't be parsed */ @SuppressWarnings("unused") default I parseLiteral(Object input, Map<String, Object> variables) throws CoercingParseLiteralException { return parseLiteral(input); }
private Object parseLiteral(Value value, GraphQLScalarType requiredType) { if (value instanceof NullValue) { return null; } return requiredType.getCoercing().parseLiteral(value); }
private boolean isArgumentValueScalarLiteral(GraphQLScalarType scalarType, Value instanceValue) { try { scalarType.getCoercing().parseLiteral(instanceValue); return true; } catch (CoercingParseLiteralException ex) { log.debug("Attempted parsing literal into '{}' but got the following error: ", scalarType.getName(), ex); return false; } } }
private boolean parseLiteral(Value value, Coercing coercing) { try { return coercing.parseLiteral(value) != null; } catch (CoercingParseLiteralException e) { return false; } }
private Object parseLiteral(Value inputValue, Coercing coercing, Map<String, Object> variables) { // the CoercingParseLiteralException exception that could happen here has been validated earlier via ValidationUtil return coercing.parseLiteral(inputValue, variables); }
/** * Called during query execution to convert an query input AST node into a Java object acceptable for the scalar type. The input * object will be an instance of {@link graphql.language.Value}. * * Note : You should not allow {@link java.lang.RuntimeException}s to come out of your parseLiteral method, but rather * catch them and fire them as {@link graphql.schema.CoercingParseLiteralException} instead as per the method contract. * * Many scalar types don't need to implement this method because they do'nt take AST {@link graphql.language.VariableReference} * objects and convert them into actual values. But for those scalar types that want to do this, then this * method should be implemented. * * @param input is never null * @param variables the resolved variables passed to the query * * @return a parsed value which is never null * * @throws graphql.schema.CoercingParseLiteralException if input literal can't be parsed */ @SuppressWarnings("unused") default I parseLiteral(Object input, Map<String, Object> variables) throws CoercingParseLiteralException { return parseLiteral(input); }
private Object parseLiteral(Value value, GraphQLScalarType requiredType) { if (value instanceof NullValue) { return null; } return requiredType.getCoercing().parseLiteral(value); }
@Override public Object parseLiteral(Object input) { return getCoercingSuper().parseLiteral(input); } };
private boolean isArgumentValueScalarLiteral(GraphQLScalarType scalarType, Value instanceValue) { try { scalarType.getCoercing().parseLiteral(instanceValue); return true; } catch (CoercingParseLiteralException ex) { log.debug("Attempted parsing literal into '{}' but got the following error: ", scalarType.getName(), ex); return false; } } }
private static String getPackageName(List<Directive> directives, String defaultPackageName) { String packageName = null; for ( Directive directive : directives ) { if ( ! "java".equals(directive.getName()) ) continue; for ( Argument arg : directive.getArguments() ) { if ( ! "package".equals(arg.getName()) ) continue; packageName = (String)Scalars.GraphQLString.getCoercing().parseLiteral(arg.getValue()); break; } break; } return ( null == packageName ) ? defaultPackageName : packageName; }