protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator<?> it = (Iterator<?>)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, scope, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }
protected int writeIterator(STWriter out, ST self, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator it = (Iterator)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, self, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }
protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator<?> it = (Iterator<?>)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, scope, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }
protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator<?> it = (Iterator<?>)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, scope, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }
protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator<?> it = (Iterator<?>)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, scope, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }
protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator<?> it = (Iterator<?>)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, scope, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }
protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator<?> it = (Iterator<?>)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, scope, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }
protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { if ( o==null ) return 0; int n = 0; Iterator<?> it = (Iterator<?>)o; String separator = null; if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; boolean seenAValue = false; while ( it.hasNext() ) { Object iterValue = it.next(); // Emit separator if we're beyond first value boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()]!=null); // or no value but null option if ( needSeparator ) n += out.writeSeparator(separator); int nw = writeObject(out, scope, iterValue, options); if ( nw > 0 ) seenAValue = true; n += nw; } return n; }