Beispiel #1
0
  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);
  }
Beispiel #2
0
  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);
  }