Skip to content

Commit

Permalink
Merge b6f1537 into 01fcf77
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Oct 29, 2018
2 parents 01fcf77 + b6f1537 commit 6bf1aed
Showing 1 changed file with 34 additions and 19 deletions.
53 changes: 34 additions & 19 deletions src/main/java/com/amihaiemil/eojsonp/ConvenientJsonGenerator.java
Expand Up @@ -35,9 +35,6 @@
* @author Mihai Andronache (amihaiemil@gmail.com)
* @version $Id$
* @since 0.0.1
* @todo #8:30min Add implementations for JsonNumber and JsonString. They should
* also be unit tested and used in this class to delegate the convenience
* writing methods to the JsonValue ones.
*/
abstract class ConvenientJsonGenerator implements JsonGenerator {

Expand Down Expand Up @@ -69,82 +66,100 @@ public abstract JsonGenerator write(

@Override
public JsonGenerator write(final String name, final String value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(name, new RtJsonString(value));
return this;
}

@Override
public JsonGenerator write(final String name, final BigInteger value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(name, new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final String name, final BigDecimal value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(name, new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final String name, final int value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(name, new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final String name, final long value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(name, new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final String name, final double value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(name, new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final String name, final boolean value) {
throw new UnsupportedOperationException("Not supported yet.");
//@checkstyle AvoidInlineConditionals (1 line)
this.write(name, new RtJsonString(value ? "true" : "false"));
return this;
}

@Override
public JsonGenerator writeNull(final String name) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(name, new RtJsonString("null"));
return this;
}

@Override
public JsonGenerator write(final String value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(new RtJsonString(value));
return this;
}

@Override
public JsonGenerator write(final BigDecimal value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final BigInteger value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final int value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final long value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final double value) {
throw new UnsupportedOperationException("Not supported yet.");
this.write(new RtJsonNumber(String.valueOf(value)));
return this;
}

@Override
public JsonGenerator write(final boolean value) {
throw new UnsupportedOperationException("Not supported yet.");
//@checkstyle AvoidInlineConditionals (1 line)
this.write(new RtJsonString(value ? "true" : "false"));
return this;
}

@Override
public JsonGenerator writeNull() {
throw new UnsupportedOperationException("Not supported yet.");
this.write(new RtJsonString("null"));
return this;
}

@Override
Expand Down

0 comments on commit 6bf1aed

Please sign in to comment.