*/
package org.opendaylight.yangtools.yang.data.codec.gson;
-import org.opendaylight.yangtools.concepts.Codec;
+import com.google.gson.stream.JsonWriter;
+import java.io.IOException;
+import org.opendaylight.yangtools.yang.data.impl.codec.DataStringCodec;
/**
* A {@link JSONCodec} which needs double quotes in output representation.
* @param <T> Deserialized value type
*/
final class QuotedJSONCodec<T> extends AbstractJSONCodec<T> {
- QuotedJSONCodec(final Codec<String, T> codec) {
+ QuotedJSONCodec(final DataStringCodec<T> codec) {
super(codec);
}
@Override
- public boolean needQuotes() {
- return true;
+ public void writeValue(final JsonWriter ctx, final T value) throws IOException {
+ ctx.value(serialize(value));
}
}
\ No newline at end of file