(STWriter out, InstanceScope scope, Object o, String[] options)
| 747 | } |
| 748 | |
| 749 | protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { |
| 750 | if ( o==null ) return 0; |
| 751 | int n = 0; |
| 752 | Iterator<?> it = (Iterator<?>)o; |
| 753 | String separator = null; |
| 754 | if ( options !=null ) separator = options[Option.SEPARATOR.ordinal()]; |
| 755 | boolean seenAValue = false; |
| 756 | while ( it.hasNext() ) { |
| 757 | Object iterValue = it.next(); |
| 758 | // Emit separator if we're beyond first value |
| 759 | boolean needSeparator = seenAValue&& separator !=null && // we have a separator and |
| 760 | (iterValue !=null || // either we have a value |
| 761 | options[Option.NULL.ordinal()]!=null); // or no value but null option |
| 762 | if ( needSeparator ) n += out.writeSeparator(separator); |
| 763 | int nw = writeObject(out, scope, iterValue, options); |
| 764 | if ( nw>0) seenAValue = true; |
| 765 | n += nw; |
| 766 | } |
| 767 | return n; |
| 768 | } |
| 769 | |
| 770 | protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { |
| 771 | String formatString = null; |
no test coverage detected