public void valuesFromNode(JsonElement json) throws EGraphQLException { if (json instanceof JsonPrimitive && ((JsonPrimitive) json).isString()) values.add(new StringValue(((JsonPrimitive)json).getAsString())); else if (json instanceof JsonPrimitive && ((JsonPrimitive) json).isNumber()) values.add(new NumberValue(((JsonPrimitive)json).getAsString())); else if (json instanceof JsonPrimitive && ((JsonPrimitive) json).isBoolean()) values.add(new NameValue(((JsonPrimitive)json).getAsBoolean())); else if (json instanceof JsonObject) values.add(new ObjectValue((JsonObject) json)); else if (json instanceof JsonArray) { for (JsonElement v : (JsonArray) json) valuesFromNode(v); } else throw new EGraphQLException("Unexpected JSON type for \""+name+"\": "+json.getClass().getName()); }
private void processPrimitive(Argument arg, Base value) { String s = value.fhirType(); if (s.equals("integer") || s.equals("decimal") || s.equals("unsignedInt") || s.equals("positiveInt")) arg.addValue(new NumberValue(value.primitiveValue())); else if (s.equals("boolean")) arg.addValue(new NameValue(value.primitiveValue())); else arg.addValue(new StringValue(value.primitiveValue())); }
private Value parseValue() throws EGraphQLException, IOException { Value result = null; switch (lexType) { case gqlltNull: throw new EGraphQLException("Attempt to read a value after reading off the } of the GraphQL statement"); case gqlltName: result = new NameValue(token.toString()); break; case gqlltPunctuation: if (hasPunctuation("$")) { consumePunctuation("$"); result = new VariableValue(token.toString()); } else if (hasPunctuation("{")) { consumePunctuation("{"); ObjectValue obj = new ObjectValue(); while (!hasPunctuation("}")) obj.getFields().add(parseArgument()); result = obj; } else throw new EGraphQLException("Attempt to read a value at \""+token.toString()+"\""); break; case gqlltString: result = new StringValue(token.toString()); break; case gqlltNumber: result = new NumberValue(token.toString()); break; } next(); return result; }
public void valuesFromNode(JsonElement json) throws EGraphQLException { if (json instanceof JsonPrimitive && ((JsonPrimitive) json).isString()) values.add(new StringValue(((JsonPrimitive)json).getAsString())); else if (json instanceof JsonPrimitive && ((JsonPrimitive) json).isNumber()) values.add(new NumberValue(((JsonPrimitive)json).getAsString())); else if (json instanceof JsonPrimitive && ((JsonPrimitive) json).isBoolean()) values.add(new NameValue(((JsonPrimitive)json).getAsBoolean())); else if (json instanceof JsonObject) values.add(new ObjectValue((JsonObject) json)); else if (json instanceof JsonArray) { for (JsonElement v : (JsonArray) json) valuesFromNode(v); } else throw new EGraphQLException("Unexpected JSON type for \""+name+"\": "+json.getClass().getName()); }
private void processPrimitive(Argument arg, Base value) { String s = value.fhirType(); if (s.equals("integer") || s.equals("decimal") || s.equals("unsignedInt") || s.equals("positiveInt")) arg.addValue(new NumberValue(value.primitiveValue())); else if (s.equals("boolean")) arg.addValue(new NameValue(value.primitiveValue())); else arg.addValue(new StringValue(value.primitiveValue())); }
private Value parseValue() throws EGraphQLException, IOException { Value result = null; switch (lexType) { case gqlltNull: throw new EGraphQLException("Attempt to read a value after reading off the } of the GraphQL statement"); case gqlltName: result = new NameValue(token.toString()); break; case gqlltPunctuation: if (hasPunctuation("$")) { consumePunctuation("$"); result = new VariableValue(token.toString()); } else if (hasPunctuation("{")) { consumePunctuation("{"); ObjectValue obj = new ObjectValue(); while (!hasPunctuation("}")) obj.getFields().add(parseArgument()); result = obj; } else throw new EGraphQLException("Attempt to read a value at \""+token.toString()+"\""); break; case gqlltString: result = new StringValue(token.toString()); break; case gqlltNumber: result = new NumberValue(token.toString()); break; } next(); return result; }