MCPcopy Create free account
hub / github.com/antlr/codebuff / writePOJO

Method writePOJO

output/java8/1.4.15/Interpreter.java:740–756  ·  view source on GitHub ↗
(STWriter out, InstanceScope scope, Object o, String[] options)

Source from the content-addressed store, hash-verified

738 }
739
740 protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
741 String formatString = null;
742 if ( options!=null ) formatString = options[Option.FORMAT.ordinal()];
743 // ask the native group defining the surrounding template for the renderer
744 AttributeRenderer r = scope.st.impl.nativeGroup.getAttributeRenderer(o.getClass());
745 String v;
746 if ( r!=null ) v = r.toString(o, formatString, locale);
747 else v = o.toString();
748 int n;
749 if ( options!=null && options[Option.WRAP.ordinal()] !=null ) {
750 n = out.write(v, options[Option.WRAP.ordinal()]);
751 }
752 else {
753 n = out.write(v);
754 }
755 return n;
756 }
757
758 protected int getExprStartChar(InstanceScope scope) {
759 Interval templateLocation = scope.st.impl.sourceMap[scope.ip];

Callers 1

writeObjectMethod · 0.95

Calls 5

toStringMethod · 0.95
ordinalMethod · 0.65
toStringMethod · 0.65
writeMethod · 0.65
getAttributeRendererMethod · 0.45

Tested by

no test coverage detected