(STWriter out, InstanceScope scope, Object o, String[] options)
| 719 | } |
| 720 | |
| 721 | protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { |
| 722 | if ( o==null ) return 0; |
| 723 | int n = 0; |
| 724 | Iterator<?> it = (Iterator<?>)o; |
| 725 | String separator = null; |
| 726 | if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()]; |
| 727 | boolean seenAValue = false; |
| 728 | while ( it.hasNext() ) { |
| 729 | Object iterValue = it.next(); |
| 730 | // Emit separator if we're beyond first value |
| 731 | 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 |
| 732 | if ( needSeparator ) n += out.writeSeparator(separator); |
| 733 | int nw = writeObject(out, scope, iterValue, options); |
| 734 | if ( nw>0) seenAValue = true; |
| 735 | n += nw; |
| 736 | } |
| 737 | return n; |
| 738 | } |
| 739 | |
| 740 | protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { |
| 741 | String formatString = null; |
no test coverage detected