(STWriter out, InstanceScope scope, Object value)
| 1124 | } |
| 1125 | |
| 1126 | protected String toString(STWriter out, InstanceScope scope, Object value) { |
| 1127 | if ( value !=null ) { |
| 1128 | if ( value.getClass()==String.class ) return (String)value; |
| 1129 | // if not string already, must evaluate it |
| 1130 | StringWriter sw = new StringWriter(); |
| 1131 | STWriter stw; |
| 1132 | try { |
| 1133 | Class<? extends STWriter> writerClass = out.getClass(); |
| 1134 | Constructor<? extends STWriter> ctor = writerClass.getConstructor(Writer.class); |
| 1135 | stw = ctor.newInstance(sw); |
| 1136 | } |
| 1137 | catch (Exception e) { |
| 1138 | stw = new AutoIndentWriter(sw); |
| 1139 | errMgr.runTimeError(this, |
| 1140 | scope, |
| 1141 | ErrorType.WRITER_CTOR_ISSUE, |
| 1142 | out.getClass().getSimpleName()); |
| 1143 | } |
| 1144 | if ( debug&& !scope.earlyEval ) { |
| 1145 | scope = new InstanceScope(scope, scope.st); |
| 1146 | scope.earlyEval = true; |
| 1147 | } |
| 1148 | writeObjectNoOptions(stw, scope, value); |
| 1149 | return sw.toString(); |
| 1150 | } |
| 1151 | return null; |
| 1152 | } |
| 1153 | |
| 1154 | public Object convertAnythingIteratableToIterator(InstanceScope scope, Object o) { |
| 1155 | Iterator<?> iter = null; |
no test coverage detected