All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.coinapi.websocket.model._VolumeBySymbol_DslJsonConverter Maven / Gradle / Ivy

package io.coinapi.websocket.model;

public class _VolumeBySymbol_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.VolumeBySymbol.class, objectConverter);
		__dsljson.registerReader(io.coinapi.websocket.model.VolumeBySymbol.class, objectConverter);
		__dsljson.registerWriter(io.coinapi.websocket.model.VolumeBySymbol.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.VolumeBySymbol read(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
			if (reader.wasNull()) return null;
			return bind(reader, new io.coinapi.websocket.model.VolumeBySymbol());
		}
		private static final byte[] quoted_assetIdQuote = "\"asset_id_quote\":".getBytes(utf8);
		private static final byte[] name_assetIdQuote = "asset_id_quote".getBytes(utf8);
		private static final byte[] quoted_volumeBase = ",\"volume_base\":".getBytes(utf8);
		private static final byte[] name_volumeBase = "volume_base".getBytes(utf8);
		private static final byte[] quoted_volumeQuote = ",\"volume_quote\":".getBytes(utf8);
		private static final byte[] name_volumeQuote = "volume_quote".getBytes(utf8);
		private static final byte[] quoted_assetIdBase = ",\"asset_id_base\":".getBytes(utf8);
		private static final byte[] name_assetIdBase = "asset_id_base".getBytes(utf8);
		private static final byte[] quoted_symbolId = ",\"symbol_id\":".getBytes(utf8);
		private static final byte[] name_symbolId = "symbol_id".getBytes(utf8);
		public final void write(final com.dslplatform.json.JsonWriter writer, final io.coinapi.websocket.model.VolumeBySymbol 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.VolumeBySymbol instance) {
			writer.writeAscii(quoted_assetIdQuote);
			if (instance.getAssetIdQuote() == null) writer.writeNull();
			else com.dslplatform.json.StringConverter.serialize(instance.getAssetIdQuote(), writer);
			writer.writeAscii(quoted_volumeBase);
			if (instance.getVolumeBase() == null) writer.writeNull();
			else com.dslplatform.json.NumberConverter.serialize(instance.getVolumeBase(), writer);
			writer.writeAscii(quoted_volumeQuote);
			if (instance.getVolumeQuote() == null) writer.writeNull();
			else com.dslplatform.json.NumberConverter.serialize(instance.getVolumeQuote(), writer);
			writer.writeAscii(quoted_assetIdBase);
			if (instance.getAssetIdBase() == null) writer.writeNull();
			else com.dslplatform.json.StringConverter.serialize(instance.getAssetIdBase(), writer);
			writer.writeAscii(quoted_symbolId);
			if (instance.getSymbolId() == null) writer.writeNull();
			else com.dslplatform.json.StringConverter.serialize(instance.getSymbolId(), writer);
		}
		public boolean writeContentMinimal(final com.dslplatform.json.JsonWriter writer, final io.coinapi.websocket.model.VolumeBySymbol instance) {
			boolean hasWritten = false;
			if (instance.getAssetIdQuote() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_assetIdQuote); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.StringConverter.serialize(instance.getAssetIdQuote(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getVolumeBase() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_volumeBase); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.NumberConverter.serialize(instance.getVolumeBase(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getVolumeQuote() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_volumeQuote); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.NumberConverter.serialize(instance.getVolumeQuote(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getAssetIdBase() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_assetIdBase); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.StringConverter.serialize(instance.getAssetIdBase(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getSymbolId() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_symbolId); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.StringConverter.serialize(instance.getSymbolId(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			return hasWritten;
		}
		public io.coinapi.websocket.model.VolumeBySymbol bind(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.VolumeBySymbol 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.VolumeBySymbol readContent(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
			io.coinapi.websocket.model.VolumeBySymbol instance = new io.coinapi.websocket.model.VolumeBySymbol();
 			bindContent(reader, instance);
			return instance;
		}
		public void bindContent(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.VolumeBySymbol instance) throws java.io.IOException {
			if (reader.last() == '}') return;
			if (reader.fillNameWeakHash() != 1497 || !reader.wasLastName(name_assetIdQuote)) { bindSlow(reader, instance, 0); return; }
			reader.getNextToken();
			instance.setAssetIdQuote(com.dslplatform.json.StringConverter.READER.read(reader));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 1170 || !reader.wasLastName(name_volumeBase)) { bindSlow(reader, instance, 1); return; }
			reader.getNextToken();
			instance.setVolumeBase(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() != 1317 || !reader.wasLastName(name_volumeQuote)) { bindSlow(reader, instance, 2); return; }
			reader.getNextToken();
			instance.setVolumeQuote(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() != 1350 || !reader.wasLastName(name_assetIdBase)) { bindSlow(reader, instance, 3); return; }
			reader.getNextToken();
			instance.setAssetIdBase(com.dslplatform.json.StringConverter.READER.read(reader));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 962 || !reader.wasLastName(name_symbolId)) { bindSlow(reader, instance, 4); return; }
			reader.getNextToken();
			instance.setSymbolId(com.dslplatform.json.StringConverter.READER.read(reader));
			if (reader.getNextToken() != '}') {
				if (reader.last() == ',') {
					reader.getNextToken();
					reader.fillNameWeakHash();
					bindSlow(reader, instance, 5);
				}
				if (reader.last() != '}') throw reader.newParseError("Expecting '}' for object end");
			}
		}
		private void bindSlow(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.VolumeBySymbol instance, int index) throws java.io.IOException {
			switch(reader.getLastHash()) {
				case -115896057:
					reader.getNextToken();
					instance.setSymbolId(com.dslplatform.json.StringConverter.READER.read(reader));
					reader.getNextToken();
					break;
				case -531648009:
					reader.getNextToken();
					instance.setAssetIdBase(com.dslplatform.json.StringConverter.READER.read(reader));
					reader.getNextToken();
					break;
				case -1854266684:
					reader.getNextToken();
					instance.setVolumeQuote(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
					reader.getNextToken();
					break;
				case 915653973:
					reader.getNextToken();
					instance.setVolumeBase(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
					reader.getNextToken();
					break;
				case 249566422:
					reader.getNextToken();
					instance.setAssetIdQuote(com.dslplatform.json.StringConverter.READER.read(reader));
					reader.getNextToken();
					break;
				default:
					reader.getNextToken();
					reader.skip();
			}
			while (reader.last() == ','){
				reader.getNextToken();
				switch(reader.fillName()) {
					case -115896057:
						reader.getNextToken();
						instance.setSymbolId(com.dslplatform.json.StringConverter.READER.read(reader));
						reader.getNextToken();
						break;
					case -531648009:
						reader.getNextToken();
						instance.setAssetIdBase(com.dslplatform.json.StringConverter.READER.read(reader));
						reader.getNextToken();
						break;
					case -1854266684:
						reader.getNextToken();
						instance.setVolumeQuote(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
						reader.getNextToken();
						break;
					case 915653973:
						reader.getNextToken();
						instance.setVolumeBase(com.dslplatform.json.NumberConverter.NULLABLE_DOUBLE_READER.read(reader));
						reader.getNextToken();
						break;
					case 249566422:
						reader.getNextToken();
						instance.setAssetIdQuote(com.dslplatform.json.StringConverter.READER.read(reader));
						reader.getNextToken();
						break;
					default:
						reader.getNextToken();
						reader.skip();
				}
			}
			if (reader.last() != '}') throw reader.newParseError("Expecting '}' for object end");
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy