File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/main/java/graphql/language Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 2121@ SuppressWarnings ("UnnecessaryLocalVariable" )
2222@ PublicApi
2323public class AstPrinter {
24+
25+ /**
26+ * @return an {@link AstPrinter} that is in full print mode
27+ */
28+ static AstPrinter full () {
29+ return new AstPrinter (false );
30+ }
31+
32+ /**
33+ * @return an {@link AstPrinter} that is in compact print mode
34+ */
35+ static AstPrinter compact () {
36+ return new AstPrinter (true );
37+ }
38+
2439 private final Map <Class <? extends Node >, NodePrinter <? extends Node >> printers = new LinkedHashMap <>();
2540
2641 private final boolean compactMode ;
@@ -803,7 +818,7 @@ public static String printAstCompact(Node node) {
803818 }
804819
805820 private static void printImpl (StringBuilder writer , Node <?> node , boolean compactMode ) {
806- AstPrinter astPrinter = new AstPrinter ( compactMode );
821+ AstPrinter astPrinter = compactMode ? compact () : full ( );
807822 NodePrinter <Node > printer = astPrinter ._findPrinter (node );
808823 printer .print (writer , node );
809824 }
You can’t perform that action at this time.
0 commit comments