All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.coinapi.websocket.model._Asks_DslJsonConverter Maven / Gradle / Ivy
package io.coinapi.websocket.model;
public class _Asks_DslJsonConverter implements com.dslplatform.json.Configuration {
private static final java.nio.charset.Charset utf8 = java.nio.charset.Charset.forName("UTF-8");
@Override
public void configure(com.dslplatform.json.DslJson __dsljson) {
ObjectFormatConverter objectConverter = new ObjectFormatConverter(__dsljson);
__dsljson.registerBinder(io.coinapi.websocket.model.Asks.class, objectConverter);
__dsljson.registerReader(io.coinapi.websocket.model.Asks.class, objectConverter);
__dsljson.registerWriter(io.coinapi.websocket.model.Asks.class, objectConverter);
}
public final static class ObjectFormatConverter implements com.dslplatform.json.runtime.FormatConverter, com.dslplatform.json.JsonReader.BindObject {
private final boolean alwaysSerialize;
private final com.dslplatform.json.DslJson __dsljson;
ObjectFormatConverter(com.dslplatform.json.DslJson __dsljson) {
this.alwaysSerialize = !__dsljson.omitDefaults;
this.__dsljson = __dsljson;
}
public io.coinapi.websocket.model.Asks read(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
if (reader.wasNull()) return null;
return bind(reader, new io.coinapi.websocket.model.Asks());
}
private static final byte[] quoted_price = "\"price\":".getBytes(utf8);
private static final byte[] name_price = "price".getBytes(utf8);
private static final byte[] quoted_size = ",\"size\":".getBytes(utf8);
private static final byte[] name_size = "size".getBytes(utf8);
public final void write(final com.dslplatform.json.JsonWriter writer, final io.coinapi.websocket.model.Asks instance) {
if (instance == null) writer.writeNull();
else {
writer.writeByte((byte)'{');
if (alwaysSerialize) { writeContentFull(writer, instance); writer.writeByte((byte)'}'); }
else if (writeContentMinimal(writer, instance)) writer.getByteBuffer()[writer.size() - 1] = '}';
else writer.writeByte((byte)'}');
}
}
public void writeContentFull(final com.dslplatform.json.JsonWriter writer, final io.coinapi.websocket.model.Asks instance) {
writer.writeAscii(quoted_price);
if (instance.getPrice() == null) writer.writeNull();
else com.dslplatform.json.NumberConverter.serialize(instance.getPrice(), writer);
writer.writeAscii(quoted_size);
if (instance.getSize() == null) writer.writeNull();
else com.dslplatform.json.NumberConverter.serialize(instance.getSize(), writer);
}
public boolean writeContentMinimal(final com.dslplatform.json.JsonWriter writer, final io.coinapi.websocket.model.Asks instance) {
boolean hasWritten = false;
if (instance.getPrice() != null) {
writer.writeByte((byte)'"'); writer.writeAscii(name_price); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
com.dslplatform.json.NumberConverter.serialize(instance.getPrice(), writer);
writer.writeByte((byte)','); hasWritten = true;
}
if (instance.getSize() != null) {
writer.writeByte((byte)'"'); writer.writeAscii(name_size); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
com.dslplatform.json.NumberConverter.serialize(instance.getSize(), writer);
writer.writeByte((byte)','); hasWritten = true;
}
return hasWritten;
}
public io.coinapi.websocket.model.Asks bind(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.Asks instance) throws java.io.IOException {
if (reader.last() != '{') throw reader.newParseError("Expecting '{' for object start");
reader.getNextToken();
bindContent(reader, instance);
return instance;
}
public io.coinapi.websocket.model.Asks readContent(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
io.coinapi.websocket.model.Asks instance = new io.coinapi.websocket.model.Asks();
bindContent(reader, instance);
return instance;
}
public void bindContent(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.Asks instance) throws java.io.IOException {
if (reader.last() == '}') return;
if (reader.fillNameWeakHash() != 531 || !reader.wasLastName(name_price)) { bindSlow(reader, instance, 0); return; }
reader.getNextToken();
instance.setPrice(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
if (reader.getNextToken() == '}') return;
if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
if (reader.fillNameWeakHash() != 443 || !reader.wasLastName(name_size)) { bindSlow(reader, instance, 1); return; }
reader.getNextToken();
instance.setSize(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
if (reader.getNextToken() != '}') {
if (reader.last() == ',') {
reader.getNextToken();
reader.fillNameWeakHash();
bindSlow(reader, instance, 2);
}
if (reader.last() != '}') throw reader.newParseError("Expecting '}' for object end");
}
}
private void bindSlow(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.Asks instance, int index) throws java.io.IOException {
switch(reader.getLastHash()) {
case 597743964:
reader.getNextToken();
instance.setSize(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
reader.getNextToken();
break;
case 189023530:
reader.getNextToken();
instance.setPrice(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
reader.getNextToken();
break;
default:
reader.getNextToken();
reader.skip();
}
while (reader.last() == ','){
reader.getNextToken();
switch(reader.fillName()) {
case 597743964:
reader.getNextToken();
instance.setSize(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
reader.getNextToken();
break;
case 189023530:
reader.getNextToken();
instance.setPrice(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
reader.getNextToken();
break;
default:
reader.getNextToken();
reader.skip();
}
}
if (reader.last() != '}') throw reader.newParseError("Expecting '}' for object end");
}
}
}