com.dslplatform.compiler.client.json.JSON Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsl-clc Show documentation
Show all versions of dsl-clc Show documentation
Command line client for interaction with DSL Platform compiler (https://dsl-platform.com)
The newest version!
package com.dslplatform.compiler.client.json;
import java.io.IOException;
import java.util.*;
public abstract class JSON {
private static Object deserializeObject(final JsonReader reader) throws IOException {
switch (reader.last()) {
case 'n':
if (!reader.wasNull()) {
throw new IOException("Expecting 'null' at position " + reader.positionInStream() + ". Found " + (char) reader.last());
}
return null;
case 't':
if (!reader.wasTrue()) {
throw new IOException("Expecting 'true' at position " + reader.positionInStream() + ". Found " + (char) reader.last());
}
return true;
case 'f':
if (!reader.wasFalse()) {
throw new IOException("Expecting 'false' at position " + reader.positionInStream() + ". Found " + (char) reader.last());
}
return false;
case '"':
return reader.readString();
case '{':
return deserializeMap(reader);
case '[':
return deserializeList(reader);
default:
return NumberConverter.deserializeNumber(reader);
}
}
private static ArrayList