MCPcopy Index your code
hub / github.com/antlr/codebuff / writeObject

Method writeObject

output/java8/1.4.13/Interpreter.java:667–700  ·  view source on GitHub ↗

Generic method to emit text for an object. It differentiates between templates, iterable objects, and plain old Java objects (POJOs)

(STWriter out, InstanceScope scope, Object o, String[] options)

Source from the content-addressed store, hash-verified

665 */
666
667 protected int writeObject(STWriter out, InstanceScope scope, Object o, String[] options) {
668 int n = 0;
669 if ( o==null ) {
670 if ( options!=null && options[Option.NULL.ordinal()] !=null ) {
671 o = options[Option.NULL.ordinal()];
672 }
673 else return 0;
674 }
675 if ( o instanceof ST ) {
676 scope = new InstanceScope(scope, (ST)o);
677 if ( options!=null && options[Option.WRAP.ordinal()] !=null ) {
678 // if we have a wrap string, then inform writer it
679 // might need to wrap
680 try {
681 out.writeWrap(options[Option.WRAP.ordinal()]);
682 }
683 catch (IOException ioe) {
684 errMgr.IOError(scope.st, ErrorType.WRITE_IO_ERROR, ioe);
685 }
686 }
687 n = exec(out, scope);
688 }
689 else {
690 o = convertAnythingIteratableToIterator(scope, o); // normalize
691 try {
692 if ( o instanceof Iterator ) n = writeIterator(out, scope, o, options);
693 else n = writePOJO(out, scope, o, options);
694 }
695 catch (IOException ioe) {
696 errMgr.IOError(scope.st, ErrorType.WRITE_IO_ERROR, ioe, o);
697 }
698 }
699 return n;
700 }
701
702 protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
703 if ( o==null ) return 0;

Callers 3

writeObjectNoOptionsMethod · 0.95
writeIteratorMethod · 0.95

Calls 7

execMethod · 0.95
writeIteratorMethod · 0.95
writePOJOMethod · 0.95
ordinalMethod · 0.65
writeWrapMethod · 0.65
IOErrorMethod · 0.65

Tested by

no test coverage detected