static void __serializeJsonObjectFull( final Person self, com.dslplatform.json.JsonWriter sw, boolean hasWrittenProperty) { sw.writeAscii("\"URI\":"); com.dslplatform.json.StringConverter.serializeShort(self.URI, sw); sw.writeAscii(",\"birth\":", 9); com.dslplatform.json.JavaTimeConverter.serialize(self.birth, sw); sw.writeAscii(",\"yearOfBirth\":", 15); com.dslplatform.json.NumberConverter.serialize(self.getYearOfBirth(), sw); sw.writeAscii(",\"dayOfBirth\":", 14); com.dslplatform.json.NumberConverter.serialize(self.getDayOfBirth(), sw); if (self.getBornOnOddDay()) { sw.writeAscii(",\"bornOnOddDay\":true"); } else { sw.writeAscii(",\"bornOnOddDay\":false"); } if (self.getBornOnEvenDay()) { sw.writeAscii(",\"bornOnEvenDay\":true"); } else { sw.writeAscii(",\"bornOnEvenDay\":false"); } sw.writeAscii(",\"AuthorID\":", 12); com.dslplatform.json.NumberConverter.serialize(self.AuthorID, sw); }
private CompositeList( final com.dslplatform.json.JsonReader<org.revenj.patterns.ServiceLocator> reader) throws java.io.IOException { String _URI_ = ""; java.util.UUID _id_ = org.revenj.Utils.MIN_UUID; gen.model.test.En[] _enn_ = _defaultenn; gen.model.test.En _en_ = gen.model.test.En.A; java.util.List<java.time.OffsetDateTime> _tsl_ = new java.util.ArrayList<java.time.OffsetDateTime>(4); java.time.LocalDate _change_ = org.revenj.Utils.MIN_LOCAL_DATE; java.util.List<gen.model.test.Entity> _entities_ = new java.util.ArrayList<gen.model.test.Entity>(4); gen.model.test.Simple _simple_ = null; int _number_ = 0; int _entitiesCount_ = 0; boolean _hasEntities_ = false; boolean[] _entityHasMoney_ = _defaultentityHasMoney; long[] _indexes_ = null; java.util.UUID _id2_ = org.revenj.Utils.MIN_UUID; byte nextToken = reader.last(); if (nextToken != '}') { int nameHash = reader.fillName(); nextToken = reader.getNextToken(); if (nextToken == 'n') { if (reader.wasNull()) { nextToken = reader.getNextToken(); } else { throw new java.io.IOException( "Expecting 'u' (as null) at position " + reader.positionInStream() + ". Found " + (char) nextToken); } } else { switch (nameHash) { case 2053729053: _URI_ = reader.readString(); nextToken = reader.getNextToken(); break; case 926444256: _id_ = com.dslplatform.json.UUIDConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case 1619944940: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken == ']') { _enn_ = new gen.model.test.En[] {}; } else { java.util.ArrayList<gen.model.test.En> __res = new java.util.ArrayList<gen.model.test.En>(4); gen.model.test.En __inst; String __val; if (nextToken == '"') { switch (reader.calcHash()) { case -1005848884: __inst = gen.model.test.En.A; break; case -955516027: __inst = gen.model.test.En.B; break; default: throw new java.io.IOException( "Unknown enum value: '" + reader.getLastName() + "' at position " + reader.positionInStream()); } __res.add(__inst); } else throw new java.io.IOException( "Expecting '\"' at position " + reader.positionInStream() + ". Found " + (char) nextToken); while ((nextToken = reader.getNextToken()) == ',') { nextToken = reader.getNextToken(); if (nextToken == '"') { switch (reader.calcHash()) { case -1005848884: __inst = gen.model.test.En.A; break; case -955516027: __inst = gen.model.test.En.B; break; default: throw new java.io.IOException( "Unknown enum value: '" + reader.getLastName() + "' at position " + reader.positionInStream()); } __res.add(__inst); } else throw new java.io.IOException( "Expecting '\"' at position " + reader.positionInStream() + ". Found " + (char) nextToken); } if (nextToken != ']') throw new java.io.IOException( "Expecting ']' at position " + reader.positionInStream() + ". Found " + (char) nextToken); _enn_ = __res.toArray(new gen.model.test.En[__res.size()]); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 1092248970: if (nextToken == '"') { switch (reader.calcHash()) { case -1005848884: _en_ = gen.model.test.En.A; break; case -955516027: _en_ = gen.model.test.En.B; break; default: throw new java.io.IOException( "Unknown enum value: '" + reader.getLastName() + "' at position " + reader.positionInStream()); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '\"' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case -1155926508: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { com.dslplatform.json.JavaTimeConverter.deserializeDateTimeNullableCollection( reader, _tsl_); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 1922892221: _change_ = com.dslplatform.json.JavaTimeConverter.deserializeLocalDate(reader); nextToken = reader.getNextToken(); break; case -922096406: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { reader.deserializeCollection(gen.model.test.Entity.JSON_READER, _entities_); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 375816319: if (nextToken == '{') { reader.getNextToken(); _simple_ = gen.model.test.Simple.JSON_READER.deserialize(reader); nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '{' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 467038368: _number_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case -39305343: _entitiesCount_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case -1925893080: _hasEntities_ = com.dslplatform.json.BoolConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case -1029283846: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { java.util.ArrayList<Boolean> __res = com.dslplatform.json.BoolConverter.deserializeCollection(reader); boolean[] __resUnboxed = new boolean[__res.size()]; for (int _i = 0; _i < __res.size(); _i++) __resUnboxed[_i] = __res.get(_i); _entityHasMoney_ = __resUnboxed; } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case -1595427141: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { java.util.ArrayList<Long> __res = com.dslplatform.json.NumberConverter.deserializeLongCollection(reader); long[] __resUnboxed = new long[__res.size()]; for (int _i = 0; _i < __res.size(); _i++) __resUnboxed[_i] = __res.get(_i); _indexes_ = __resUnboxed; } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case -1076877162: _id2_ = com.dslplatform.json.UUIDConverter.deserialize(reader); nextToken = reader.getNextToken(); break; default: nextToken = reader.skip(); break; } } while (nextToken == ',') { nextToken = reader.getNextToken(); nameHash = reader.fillName(); nextToken = reader.getNextToken(); if (nextToken == 'n') { if (reader.wasNull()) { nextToken = reader.getNextToken(); continue; } else { throw new java.io.IOException( "Expecting 'u' (as null) at position " + reader.positionInStream() + ". Found " + (char) nextToken); } } switch (nameHash) { case 2053729053: _URI_ = reader.readString(); nextToken = reader.getNextToken(); break; case 926444256: _id_ = com.dslplatform.json.UUIDConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case 1619944940: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken == ']') { _enn_ = new gen.model.test.En[] {}; } else { java.util.ArrayList<gen.model.test.En> __res = new java.util.ArrayList<gen.model.test.En>(4); gen.model.test.En __inst; String __val; if (nextToken == '"') { switch (reader.calcHash()) { case -1005848884: __inst = gen.model.test.En.A; break; case -955516027: __inst = gen.model.test.En.B; break; default: throw new java.io.IOException( "Unknown enum value: '" + reader.getLastName() + "' at position " + reader.positionInStream()); } __res.add(__inst); } else throw new java.io.IOException( "Expecting '\"' at position " + reader.positionInStream() + ". Found " + (char) nextToken); while ((nextToken = reader.getNextToken()) == ',') { nextToken = reader.getNextToken(); if (nextToken == '"') { switch (reader.calcHash()) { case -1005848884: __inst = gen.model.test.En.A; break; case -955516027: __inst = gen.model.test.En.B; break; default: throw new java.io.IOException( "Unknown enum value: '" + reader.getLastName() + "' at position " + reader.positionInStream()); } __res.add(__inst); } else throw new java.io.IOException( "Expecting '\"' at position " + reader.positionInStream() + ". Found " + (char) nextToken); } if (nextToken != ']') throw new java.io.IOException( "Expecting ']' at position " + reader.positionInStream() + ". Found " + (char) nextToken); _enn_ = __res.toArray(new gen.model.test.En[__res.size()]); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 1092248970: if (nextToken == '"') { switch (reader.calcHash()) { case -1005848884: _en_ = gen.model.test.En.A; break; case -955516027: _en_ = gen.model.test.En.B; break; default: throw new java.io.IOException( "Unknown enum value: '" + reader.getLastName() + "' at position " + reader.positionInStream()); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '\"' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case -1155926508: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { com.dslplatform.json.JavaTimeConverter.deserializeDateTimeNullableCollection( reader, _tsl_); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 1922892221: _change_ = com.dslplatform.json.JavaTimeConverter.deserializeLocalDate(reader); nextToken = reader.getNextToken(); break; case -922096406: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { reader.deserializeCollection(gen.model.test.Entity.JSON_READER, _entities_); } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 375816319: if (nextToken == '{') { reader.getNextToken(); _simple_ = gen.model.test.Simple.JSON_READER.deserialize(reader); nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '{' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case 467038368: _number_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case -39305343: _entitiesCount_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case -1925893080: _hasEntities_ = com.dslplatform.json.BoolConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case -1029283846: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { java.util.ArrayList<Boolean> __res = com.dslplatform.json.BoolConverter.deserializeCollection(reader); boolean[] __resUnboxed = new boolean[__res.size()]; for (int _i = 0; _i < __res.size(); _i++) __resUnboxed[_i] = __res.get(_i); _entityHasMoney_ = __resUnboxed; } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case -1595427141: if (nextToken == '[') { nextToken = reader.getNextToken(); if (nextToken != ']') { java.util.ArrayList<Long> __res = com.dslplatform.json.NumberConverter.deserializeLongCollection(reader); long[] __resUnboxed = new long[__res.size()]; for (int _i = 0; _i < __res.size(); _i++) __resUnboxed[_i] = __res.get(_i); _indexes_ = __resUnboxed; } nextToken = reader.getNextToken(); } else throw new java.io.IOException( "Expecting '[' at position " + reader.positionInStream() + ". Found " + (char) nextToken); break; case -1076877162: _id2_ = com.dslplatform.json.UUIDConverter.deserialize(reader); nextToken = reader.getNextToken(); break; default: nextToken = reader.skip(); break; } } if (nextToken != '}') { throw new java.io.IOException( "Expecting '}' at position " + reader.positionInStream() + ". Found " + (char) nextToken); } } this.URI = _URI_; this.id = _id_; this.enn = _enn_; this.en = _en_; this.tsl = _tsl_; this.change = _change_; this.entities = _entities_; this.simple = _simple_; this.number = _number_; this.entitiesCount = _entitiesCount_; this.hasEntities = _hasEntities_; this.entityHasMoney = _entityHasMoney_; this.indexes = _indexes_; this.id2 = _id2_; }
static void __serializeJsonObjectFull( final CompositeList self, com.dslplatform.json.JsonWriter sw, boolean hasWrittenProperty) { sw.writeAscii("\"URI\":"); com.dslplatform.json.StringConverter.serializeShort(self.URI, sw); sw.writeAscii(",\"id\":", 6); com.dslplatform.json.UUIDConverter.serialize(self.id, sw); if (self.enn.length != 0) { sw.writeAscii(",\"enn\":[", 8); gen.model.test.En item = self.enn[0]; sw.writeByte(com.dslplatform.json.JsonWriter.QUOTE); sw.writeAscii(item.name()); sw.writeByte(com.dslplatform.json.JsonWriter.QUOTE); for (int i = 1; i < self.enn.length; i++) { sw.writeByte(com.dslplatform.json.JsonWriter.COMMA); item = self.enn[i]; sw.writeByte(com.dslplatform.json.JsonWriter.QUOTE); sw.writeAscii(item.name()); sw.writeByte(com.dslplatform.json.JsonWriter.QUOTE); } sw.writeByte(com.dslplatform.json.JsonWriter.ARRAY_END); } else sw.writeAscii(",\"enn\":[]", 9); sw.writeAscii(",\"en\":\"", 7); sw.writeAscii(self.en.name()); sw.writeByte(com.dslplatform.json.JsonWriter.QUOTE); if (self.tsl.size() != 0) { sw.writeAscii(",\"tsl\":[", 8); com.dslplatform.json.JavaTimeConverter.serializeNullable(self.tsl.get(0), sw); for (int i = 1; i < self.tsl.size(); i++) { sw.writeByte(com.dslplatform.json.JsonWriter.COMMA); com.dslplatform.json.JavaTimeConverter.serializeNullable(self.tsl.get(i), sw); } sw.writeByte(com.dslplatform.json.JsonWriter.ARRAY_END); } else sw.writeAscii(",\"tsl\":[]", 9); sw.writeAscii(",\"change\":", 10); com.dslplatform.json.JavaTimeConverter.serialize(self.change, sw); if (self.entities.size() != 0) { sw.writeAscii(",\"entities\":[", 13); gen.model.test.Entity item = self.entities.get(0); sw.writeByte(com.dslplatform.json.JsonWriter.OBJECT_START); gen.model.test.Entity.__serializeJsonObjectFull(item, sw, false); sw.writeByte(com.dslplatform.json.JsonWriter.OBJECT_END); for (int i = 1; i < self.entities.size(); i++) { sw.writeByte(com.dslplatform.json.JsonWriter.COMMA); item = self.entities.get(i); sw.writeByte(com.dslplatform.json.JsonWriter.OBJECT_START); gen.model.test.Entity.__serializeJsonObjectFull(item, sw, false); sw.writeByte(com.dslplatform.json.JsonWriter.OBJECT_END); } sw.writeByte(com.dslplatform.json.JsonWriter.ARRAY_END); } else sw.writeAscii(",\"entities\":[]", 14); sw.writeAscii(",\"simple\":{", 11); gen.model.test.Simple.__serializeJsonObjectFull(self.simple, sw, false); sw.writeByte(com.dslplatform.json.JsonWriter.OBJECT_END); sw.writeAscii(",\"number\":", 10); com.dslplatform.json.NumberConverter.serialize(self.number, sw); sw.writeAscii(",\"entitiesCount\":", 17); com.dslplatform.json.NumberConverter.serialize(self.entitiesCount, sw); if (self.hasEntities) { sw.writeAscii(",\"hasEntities\":true"); } else { sw.writeAscii(",\"hasEntities\":false"); } if (self.entityHasMoney.length != 0) { sw.writeAscii(",\"entityHasMoney\":[", 19); com.dslplatform.json.BoolConverter.serialize(self.entityHasMoney[0], sw); for (int i = 1; i < self.entityHasMoney.length; i++) { sw.writeByte(com.dslplatform.json.JsonWriter.COMMA); com.dslplatform.json.BoolConverter.serialize(self.entityHasMoney[i], sw); } sw.writeByte(com.dslplatform.json.JsonWriter.ARRAY_END); } else sw.writeAscii(",\"entityHasMoney\":[]", 20); if (self.indexes != null && self.indexes.length != 0) { sw.writeAscii(",\"indexes\":[", 12); com.dslplatform.json.NumberConverter.serialize(self.indexes[0], sw); for (int i = 1; i < self.indexes.length; i++) { sw.writeByte(com.dslplatform.json.JsonWriter.COMMA); com.dslplatform.json.NumberConverter.serialize(self.indexes[i], sw); } sw.writeByte(com.dslplatform.json.JsonWriter.ARRAY_END); } else if (self.indexes != null) sw.writeAscii(",\"indexes\":[]", 13); else sw.writeAscii(",\"indexes\":null", 15); sw.writeAscii(",\"id2\":", 7); com.dslplatform.json.UUIDConverter.serialize(self.getId2(), sw); }
private Person(final com.dslplatform.json.JsonReader<org.revenj.patterns.ServiceLocator> reader) throws java.io.IOException { String _URI_ = ""; this.__locator = java.util.Optional.ofNullable(reader.context); java.time.LocalDate _birth_ = org.revenj.Utils.MIN_LOCAL_DATE; int _yearOfBirth_ = 0; int _dayOfBirth_ = 0; boolean _bornOnOddDay_ = false; boolean _bornOnEvenDay_ = false; int _AuthorID_ = 0; byte nextToken = reader.last(); if (nextToken != '}') { int nameHash = reader.fillName(); nextToken = reader.getNextToken(); if (nextToken == 'n') { if (reader.wasNull()) { nextToken = reader.getNextToken(); } else { throw new java.io.IOException( "Expecting 'u' (as null) at position " + reader.positionInStream() + ". Found " + (char) nextToken); } } else { switch (nameHash) { case 2053729053: _URI_ = reader.readString(); nextToken = reader.getNextToken(); break; case 558509118: _birth_ = com.dslplatform.json.JavaTimeConverter.deserializeLocalDate(reader); nextToken = reader.getNextToken(); break; case 2018960198: _yearOfBirth_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case 1594185545: _dayOfBirth_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case 779623722: _bornOnOddDay_ = com.dslplatform.json.BoolConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case 1988452239: _bornOnEvenDay_ = com.dslplatform.json.BoolConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case 23797067: _AuthorID_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; default: nextToken = reader.skip(); break; } } while (nextToken == ',') { nextToken = reader.getNextToken(); nameHash = reader.fillName(); nextToken = reader.getNextToken(); if (nextToken == 'n') { if (reader.wasNull()) { nextToken = reader.getNextToken(); continue; } else { throw new java.io.IOException( "Expecting 'u' (as null) at position " + reader.positionInStream() + ". Found " + (char) nextToken); } } switch (nameHash) { case 2053729053: _URI_ = reader.readString(); nextToken = reader.getNextToken(); break; case 558509118: _birth_ = com.dslplatform.json.JavaTimeConverter.deserializeLocalDate(reader); nextToken = reader.getNextToken(); break; case 2018960198: _yearOfBirth_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case 1594185545: _dayOfBirth_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; case 779623722: _bornOnOddDay_ = com.dslplatform.json.BoolConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case 1988452239: _bornOnEvenDay_ = com.dslplatform.json.BoolConverter.deserialize(reader); nextToken = reader.getNextToken(); break; case 23797067: _AuthorID_ = com.dslplatform.json.NumberConverter.deserializeInt(reader); nextToken = reader.getNextToken(); break; default: nextToken = reader.skip(); break; } } if (nextToken != '}') { throw new java.io.IOException( "Expecting '}' at position " + reader.positionInStream() + ". Found " + (char) nextToken); } } this.URI = _URI_; this.birth = _birth_; this.yearOfBirth = _yearOfBirth_; this.dayOfBirth = _dayOfBirth_; this.bornOnOddDay = _bornOnOddDay_; this.bornOnEvenDay = _bornOnEvenDay_; this.AuthorID = _AuthorID_; }