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

Method writeObject

output/java8/1.4.19/Interpreter.java:688–721  ·  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

686 */
687
688 protected int writeObject(STWriter out, InstanceScope scope, Object o, String[] options) {
689 int n = 0;
690 if ( o==null ) {
691 if ( options!=null && options[Option.NULL.ordinal()] !=null ) {
692 o = options[Option.NULL.ordinal()];
693 }
694 else return 0;
695 }
696 if ( o instanceof ST ) {
697 scope = new InstanceScope(scope, (ST)o);
698 if ( options!=null && options[Option.WRAP.ordinal()] !=null ) {
699 // if we have a wrap string, then inform writer it
700 // might need to wrap
701 try {
702 out.writeWrap(options[Option.WRAP.ordinal()]);
703 }
704 catch (IOException ioe) {
705 errMgr.IOError(scope.st, ErrorType.WRITE_IO_ERROR, ioe);
706 }
707 }
708 n = exec(out, scope);
709 }
710 else {
711 o = convertAnythingIteratableToIterator(scope, o); // normalize
712 try {
713 if ( o instanceof Iterator ) n = writeIterator(out, scope, o, options);
714 else n = writePOJO(out, scope, o, options);
715 }
716 catch (IOException ioe) {
717 errMgr.IOError(scope.st, ErrorType.WRITE_IO_ERROR, ioe, o);
718 }
719 }
720 return n;
721 }
722
723 protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
724 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