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

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

package io.coinapi.websocket.model;

public class _Hello_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.Hello.class, objectConverter);
		__dsljson.registerReader(io.coinapi.websocket.model.Hello.class, objectConverter);
		__dsljson.registerWriter(io.coinapi.websocket.model.Hello.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;
		private final com.dslplatform.json.JsonReader.ReadObject reader_subscribeFilterAssetId;
		private final com.dslplatform.json.JsonWriter.WriteObject writer_subscribeFilterAssetId;
		private final java.lang.String[] emptyArray_subscribeFilterAssetId;
		private final com.dslplatform.json.JsonReader.ReadObject reader_subscribeDataType;
		private final com.dslplatform.json.JsonWriter.WriteObject writer_subscribeDataType;
		private final java.lang.String[] emptyArray_subscribeDataType;
		private final com.dslplatform.json.JsonReader.ReadObject reader_subscribeFilterPeriodId;
		private final com.dslplatform.json.JsonWriter.WriteObject writer_subscribeFilterPeriodId;
		private final java.lang.String[] emptyArray_subscribeFilterPeriodId;
		private final com.dslplatform.json.JsonReader.ReadObject reader_subscribeFilterSymbolId;
		private final com.dslplatform.json.JsonWriter.WriteObject writer_subscribeFilterSymbolId;
		private final java.lang.String[] emptyArray_subscribeFilterSymbolId;
		private final com.dslplatform.json.JsonReader.ReadObject reader_subscribeFilterExchangeId;
		private final com.dslplatform.json.JsonWriter.WriteObject writer_subscribeFilterExchangeId;
		private final java.lang.String[] emptyArray_subscribeFilterExchangeId;
		ObjectFormatConverter(com.dslplatform.json.DslJson __dsljson) {
			this.alwaysSerialize = !__dsljson.omitDefaults;
			this.__dsljson = __dsljson;
			this.reader_subscribeFilterAssetId = com.dslplatform.json.StringConverter.READER;
			this.writer_subscribeFilterAssetId = com.dslplatform.json.StringConverter.WRITER;
			this.emptyArray_subscribeFilterAssetId = (java.lang.String[]) java.lang.reflect.Array.newInstance((Class) java.lang.String.class, 0);
			this.reader_subscribeDataType = com.dslplatform.json.StringConverter.READER;
			this.writer_subscribeDataType = com.dslplatform.json.StringConverter.WRITER;
			this.emptyArray_subscribeDataType = (java.lang.String[]) java.lang.reflect.Array.newInstance((Class) java.lang.String.class, 0);
			this.reader_subscribeFilterPeriodId = com.dslplatform.json.StringConverter.READER;
			this.writer_subscribeFilterPeriodId = com.dslplatform.json.StringConverter.WRITER;
			this.emptyArray_subscribeFilterPeriodId = (java.lang.String[]) java.lang.reflect.Array.newInstance((Class) java.lang.String.class, 0);
			this.reader_subscribeFilterSymbolId = com.dslplatform.json.StringConverter.READER;
			this.writer_subscribeFilterSymbolId = com.dslplatform.json.StringConverter.WRITER;
			this.emptyArray_subscribeFilterSymbolId = (java.lang.String[]) java.lang.reflect.Array.newInstance((Class) java.lang.String.class, 0);
			this.reader_subscribeFilterExchangeId = com.dslplatform.json.StringConverter.READER;
			this.writer_subscribeFilterExchangeId = com.dslplatform.json.StringConverter.WRITER;
			this.emptyArray_subscribeFilterExchangeId = (java.lang.String[]) java.lang.reflect.Array.newInstance((Class) java.lang.String.class, 0);
		}
		public io.coinapi.websocket.model.Hello read(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
			if (reader.wasNull()) return null;
			return bind(reader, new io.coinapi.websocket.model.Hello());
		}
		private static final byte[] quoted_subscribeFilterExchangeId = "\"subscribe_filter_exchange_id\":".getBytes(utf8);
		private static final byte[] name_subscribeFilterExchangeId = "subscribe_filter_exchange_id".getBytes(utf8);
		private static final byte[] quoted_subscribeFilterSymbolId = ",\"subscribe_filter_symbol_id\":".getBytes(utf8);
		private static final byte[] name_subscribeFilterSymbolId = "subscribe_filter_symbol_id".getBytes(utf8);
		private static final byte[] quoted_subscribeUpdateLimitMsQuote = ",\"subscribe_update_limit_ms_quote\":".getBytes(utf8);
		private static final byte[] name_subscribeUpdateLimitMsQuote = "subscribe_update_limit_ms_quote".getBytes(utf8);
		private static final byte[] quoted_subscribeFilterPeriodId = ",\"subscribe_filter_period_id\":".getBytes(utf8);
		private static final byte[] name_subscribeFilterPeriodId = "subscribe_filter_period_id".getBytes(utf8);
		private static final byte[] quoted_subscribeDataType = ",\"subscribe_data_type\":".getBytes(utf8);
		private static final byte[] name_subscribeDataType = "subscribe_data_type".getBytes(utf8);
		private static final byte[] quoted_heartbeat = ",\"heartbeat\":".getBytes(utf8);
		private static final byte[] name_heartbeat = "heartbeat".getBytes(utf8);
		private static final byte[] quoted_subscribeUpdateLimitMsBookSnapshot = ",\"subscribe_update_limit_ms_book_snapshot\":".getBytes(utf8);
		private static final byte[] name_subscribeUpdateLimitMsBookSnapshot = "subscribe_update_limit_ms_book_snapshot".getBytes(utf8);
		private static final byte[] quoted_apiKey = ",\"apiKey\":".getBytes(utf8);
		private static final byte[] name_apiKey = "apiKey".getBytes(utf8);
		private static final byte[] quoted_subscribeFilterAssetId = ",\"subscribe_filter_asset_id\":".getBytes(utf8);
		private static final byte[] name_subscribeFilterAssetId = "subscribe_filter_asset_id".getBytes(utf8);
		public final void write(final com.dslplatform.json.JsonWriter writer, final io.coinapi.websocket.model.Hello 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.Hello instance) {
			writer.writeAscii(quoted_subscribeFilterExchangeId);
			if (instance.getSubscribeFilterExchangeId() == null) writer.writeNull();
			else writer.serialize(instance.getSubscribeFilterExchangeId(), writer_subscribeFilterExchangeId);
			writer.writeAscii(quoted_subscribeFilterSymbolId);
			if (instance.getSubscribeFilterSymbolId() == null) writer.writeNull();
			else writer.serialize(instance.getSubscribeFilterSymbolId(), writer_subscribeFilterSymbolId);
			writer.writeAscii(quoted_subscribeUpdateLimitMsQuote);
			if (instance.getSubscribeUpdateLimitMsQuote() == null) writer.writeNull();
			else com.dslplatform.json.NumberConverter.serialize(instance.getSubscribeUpdateLimitMsQuote(), writer);
			writer.writeAscii(quoted_subscribeFilterPeriodId);
			if (instance.getSubscribeFilterPeriodId() == null) writer.writeNull();
			else writer.serialize(instance.getSubscribeFilterPeriodId(), writer_subscribeFilterPeriodId);
			writer.writeAscii(quoted_subscribeDataType);
			if (instance.getSubscribeDataType() == null) writer.writeNull();
			else writer.serialize(instance.getSubscribeDataType(), writer_subscribeDataType);
			writer.writeAscii(quoted_heartbeat);
			if (instance.getHeartbeat() == null) writer.writeNull();
			else com.dslplatform.json.BoolConverter.serialize(instance.getHeartbeat(), writer);
			writer.writeAscii(quoted_subscribeUpdateLimitMsBookSnapshot);
			if (instance.getSubscribeUpdateLimitMsBookSnapshot() == null) writer.writeNull();
			else com.dslplatform.json.NumberConverter.serialize(instance.getSubscribeUpdateLimitMsBookSnapshot(), writer);
			writer.writeAscii(quoted_apiKey);
			if (instance.getApiKey() == null) writer.writeNull();
			else com.dslplatform.json.StringConverter.serialize(instance.getApiKey(), writer);
			writer.writeAscii(quoted_subscribeFilterAssetId);
			if (instance.getSubscribeFilterAssetId() == null) writer.writeNull();
			else writer.serialize(instance.getSubscribeFilterAssetId(), writer_subscribeFilterAssetId);
		}
		public boolean writeContentMinimal(final com.dslplatform.json.JsonWriter writer, final io.coinapi.websocket.model.Hello instance) {
			boolean hasWritten = false;
			if (instance.getSubscribeFilterExchangeId() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_subscribeFilterExchangeId); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				writer.serialize(instance.getSubscribeFilterExchangeId(), writer_subscribeFilterExchangeId);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getSubscribeFilterSymbolId() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_subscribeFilterSymbolId); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				writer.serialize(instance.getSubscribeFilterSymbolId(), writer_subscribeFilterSymbolId);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getSubscribeUpdateLimitMsQuote() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_subscribeUpdateLimitMsQuote); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.NumberConverter.serialize(instance.getSubscribeUpdateLimitMsQuote(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getSubscribeFilterPeriodId() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_subscribeFilterPeriodId); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				writer.serialize(instance.getSubscribeFilterPeriodId(), writer_subscribeFilterPeriodId);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getSubscribeDataType() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_subscribeDataType); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				writer.serialize(instance.getSubscribeDataType(), writer_subscribeDataType);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getHeartbeat() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_heartbeat); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.BoolConverter.serialize(instance.getHeartbeat(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getSubscribeUpdateLimitMsBookSnapshot() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_subscribeUpdateLimitMsBookSnapshot); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.NumberConverter.serialize(instance.getSubscribeUpdateLimitMsBookSnapshot(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getApiKey() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_apiKey); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				com.dslplatform.json.StringConverter.serialize(instance.getApiKey(), writer);
				writer.writeByte((byte)','); hasWritten = true;
			}
			if (instance.getSubscribeFilterAssetId() != null) {
				writer.writeByte((byte)'"'); writer.writeAscii(name_subscribeFilterAssetId); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
				writer.serialize(instance.getSubscribeFilterAssetId(), writer_subscribeFilterAssetId);
				writer.writeByte((byte)','); hasWritten = true;
			}
			return hasWritten;
		}
		public io.coinapi.websocket.model.Hello bind(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.Hello 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.Hello readContent(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
			io.coinapi.websocket.model.Hello instance = new io.coinapi.websocket.model.Hello();
 			bindContent(reader, instance);
			return instance;
		}
		public void bindContent(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.Hello instance) throws java.io.IOException {
			if (reader.last() == '}') return;
			if (reader.fillNameWeakHash() != 2933 || !reader.wasLastName(name_subscribeFilterExchangeId)) { bindSlow(reader, instance, 0); return; }
			reader.getNextToken();
			instance.setSubscribeFilterExchangeId((java.lang.String[])reader.readArray(reader_subscribeFilterExchangeId, emptyArray_subscribeFilterExchangeId));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 2760 || !reader.wasLastName(name_subscribeFilterSymbolId)) { bindSlow(reader, instance, 1); return; }
			reader.getNextToken();
			instance.setSubscribeFilterSymbolId((java.lang.String[])reader.readArray(reader_subscribeFilterSymbolId, emptyArray_subscribeFilterSymbolId));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 3310 || !reader.wasLastName(name_subscribeUpdateLimitMsQuote)) { bindSlow(reader, instance, 2); return; }
			reader.getNextToken();
			instance.setSubscribeUpdateLimitMsQuote(com.dslplatform.json.NumberConverter.NULLABLE_INT_READER.read(reader));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 2741 || !reader.wasLastName(name_subscribeFilterPeriodId)) { bindSlow(reader, instance, 3); return; }
			reader.getNextToken();
			instance.setSubscribeFilterPeriodId((java.lang.String[])reader.readArray(reader_subscribeFilterPeriodId, emptyArray_subscribeFilterPeriodId));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 2012 || !reader.wasLastName(name_subscribeDataType)) { bindSlow(reader, instance, 4); return; }
			reader.getNextToken();
			instance.setSubscribeDataType((java.lang.String[])reader.readArray(reader_subscribeDataType, emptyArray_subscribeDataType));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 944 || !reader.wasLastName(name_heartbeat)) { bindSlow(reader, instance, 5); return; }
			reader.getNextToken();
			instance.setHeartbeat(com.dslplatform.json.BoolConverter.NULLABLE_READER.read(reader));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 4154 || !reader.wasLastName(name_subscribeUpdateLimitMsBookSnapshot)) { bindSlow(reader, instance, 6); return; }
			reader.getNextToken();
			instance.setSubscribeUpdateLimitMsBookSnapshot(com.dslplatform.json.NumberConverter.NULLABLE_INT_READER.read(reader));
			if (reader.getNextToken() == '}')  return;
			if (reader.last() != ',') throw reader.newParseError("Expecting ',' for other mandatory properties"); else reader.getNextToken();
			if (reader.fillNameWeakHash() != 611 || !reader.wasLastName(name_apiKey)) { bindSlow(reader, instance, 7); return; }
			reader.getNextToken();
			instance.setApiKey(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() != 2642 || !reader.wasLastName(name_subscribeFilterAssetId)) { bindSlow(reader, instance, 8); return; }
			reader.getNextToken();
			instance.setSubscribeFilterAssetId((java.lang.String[])reader.readArray(reader_subscribeFilterAssetId, emptyArray_subscribeFilterAssetId));
			if (reader.getNextToken() != '}') {
				if (reader.last() == ',') {
					reader.getNextToken();
					reader.fillNameWeakHash();
					bindSlow(reader, instance, 9);
				}
				if (reader.last() != '}') throw reader.newParseError("Expecting '}' for object end");
			}
		}
		private void bindSlow(final com.dslplatform.json.JsonReader reader, final io.coinapi.websocket.model.Hello instance, int index) throws java.io.IOException {
			switch(reader.getLastHash()) {
				case 1392331:
					reader.getNextToken();
					instance.setSubscribeFilterAssetId((java.lang.String[])reader.readArray(reader_subscribeFilterAssetId, emptyArray_subscribeFilterAssetId));
					reader.getNextToken();
					break;
				case 490490654:
					reader.getNextToken();
					instance.setApiKey(com.dslplatform.json.StringConverter.READER.read(reader));
					reader.getNextToken();
					break;
				case 516814075:
					reader.getNextToken();
					instance.setSubscribeUpdateLimitMsBookSnapshot(com.dslplatform.json.NumberConverter.NULLABLE_INT_READER.read(reader));
					reader.getNextToken();
					break;
				case -1482800105:
					reader.getNextToken();
					instance.setHeartbeat(com.dslplatform.json.BoolConverter.NULLABLE_READER.read(reader));
					reader.getNextToken();
					break;
				case -1421021871:
					reader.getNextToken();
					instance.setSubscribeDataType((java.lang.String[])reader.readArray(reader_subscribeDataType, emptyArray_subscribeDataType));
					reader.getNextToken();
					break;
				case 1545866250:
					reader.getNextToken();
					instance.setSubscribeFilterPeriodId((java.lang.String[])reader.readArray(reader_subscribeFilterPeriodId, emptyArray_subscribeFilterPeriodId));
					reader.getNextToken();
					break;
				case -866636915:
					reader.getNextToken();
					instance.setSubscribeUpdateLimitMsQuote(com.dslplatform.json.NumberConverter.NULLABLE_INT_READER.read(reader));
					reader.getNextToken();
					break;
				case -154324799:
					reader.getNextToken();
					instance.setSubscribeFilterSymbolId((java.lang.String[])reader.readArray(reader_subscribeFilterSymbolId, emptyArray_subscribeFilterSymbolId));
					reader.getNextToken();
					break;
				case -2127024950:
					reader.getNextToken();
					instance.setSubscribeFilterExchangeId((java.lang.String[])reader.readArray(reader_subscribeFilterExchangeId, emptyArray_subscribeFilterExchangeId));
					reader.getNextToken();
					break;
				default:
					reader.getNextToken();
					reader.skip();
			}
			while (reader.last() == ','){
				reader.getNextToken();
				switch(reader.fillName()) {
					case 1392331:
						reader.getNextToken();
						instance.setSubscribeFilterAssetId((java.lang.String[])reader.readArray(reader_subscribeFilterAssetId, emptyArray_subscribeFilterAssetId));
						reader.getNextToken();
						break;
					case 490490654:
						reader.getNextToken();
						instance.setApiKey(com.dslplatform.json.StringConverter.READER.read(reader));
						reader.getNextToken();
						break;
					case 516814075:
						reader.getNextToken();
						instance.setSubscribeUpdateLimitMsBookSnapshot(com.dslplatform.json.NumberConverter.NULLABLE_INT_READER.read(reader));
						reader.getNextToken();
						break;
					case -1482800105:
						reader.getNextToken();
						instance.setHeartbeat(com.dslplatform.json.BoolConverter.NULLABLE_READER.read(reader));
						reader.getNextToken();
						break;
					case -1421021871:
						reader.getNextToken();
						instance.setSubscribeDataType((java.lang.String[])reader.readArray(reader_subscribeDataType, emptyArray_subscribeDataType));
						reader.getNextToken();
						break;
					case 1545866250:
						reader.getNextToken();
						instance.setSubscribeFilterPeriodId((java.lang.String[])reader.readArray(reader_subscribeFilterPeriodId, emptyArray_subscribeFilterPeriodId));
						reader.getNextToken();
						break;
					case -866636915:
						reader.getNextToken();
						instance.setSubscribeUpdateLimitMsQuote(com.dslplatform.json.NumberConverter.NULLABLE_INT_READER.read(reader));
						reader.getNextToken();
						break;
					case -154324799:
						reader.getNextToken();
						instance.setSubscribeFilterSymbolId((java.lang.String[])reader.readArray(reader_subscribeFilterSymbolId, emptyArray_subscribeFilterSymbolId));
						reader.getNextToken();
						break;
					case -2127024950:
						reader.getNextToken();
						instance.setSubscribeFilterExchangeId((java.lang.String[])reader.readArray(reader_subscribeFilterExchangeId, emptyArray_subscribeFilterExchangeId));
						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