001package org.hl7.fhir.utilities.graphql; 002 003public class GraphQLResponse extends ObjectValue { 004 private boolean writeWrapper = true; 005 006 /** 007 * Should the "data" wrapper br written along with the output 008 */ 009 public void setWriteWrapper(boolean theWriteWrapper) { 010 writeWrapper = theWriteWrapper; 011 } 012 013 @Override 014 public void write(StringBuilder b, Integer indent, String lineSeparator) throws EGraphQLException, EGraphEngine { 015 016 if (writeWrapper) { 017 // Write the wrapper 018 b.append("{ \"data\": "); 019 } 020 021 super.write(b, indent, lineSeparator); 022 023 if (writeWrapper) { 024 // Terminate the wrapper 025 b.append("}"); 026 } 027 028 } 029}