(STWriter out, InstanceScope scope, Object o, String[] options)
| 700 | } |
| 701 | |
| 702 | protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { |
| 703 | if ( o==null ) return 0; |
| 704 | int n = 0; |
| 705 | Iterator<?> it = (Iterator<?>)o; |
| 706 | String separator = null; |
| 707 | if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; |
| 708 | boolean seenAValue = false; |
| 709 | while ( it.hasNext() ) { |
| 710 | Object iterValue = it.next(); |
| 711 | // Emit separator if we're beyond first value |
| 712 | 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 |
| 713 | if ( needSeparator ) n += out.writeSeparator(separator); |
| 714 | int nw = writeObject(out, scope, iterValue, options); |
| 715 | if ( nw>0) seenAValue = true; |
| 716 | n += nw; |
| 717 | } |
| 718 | return n; |
| 719 | } |
| 720 | |
| 721 | protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { |
| 722 | String formatString = null; |
no test coverage detected