コード例 #1
0
ファイル: CompositeList.java プロジェクト: dstimac/revenj
  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_;
  }
コード例 #2
0
ファイル: CompositeList.java プロジェクト: dstimac/revenj
    private ForSimple(
        final com.dslplatform.json.JsonReader<org.revenj.patterns.ServiceLocator> reader)
        throws java.io.IOException {

      java.util.List<gen.model.test.Simple> _simples_ =
          new java.util.ArrayList<gen.model.test.Simple>(4);
      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 1331401444:
              if (nextToken == '[') {
                nextToken = reader.getNextToken();
                if (nextToken != ']') {
                  reader.deserializeCollection(gen.model.test.Simple.JSON_READER, _simples_);
                }
                nextToken = reader.getNextToken();
              } else
                throw new java.io.IOException(
                    "Expecting '[' at position "
                        + reader.positionInStream()
                        + ". Found "
                        + (char) nextToken);
              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 1331401444:
              if (nextToken == '[') {
                nextToken = reader.getNextToken();
                if (nextToken != ']') {
                  reader.deserializeCollection(gen.model.test.Simple.JSON_READER, _simples_);
                }
                nextToken = reader.getNextToken();
              } else
                throw new java.io.IOException(
                    "Expecting '[' at position "
                        + reader.positionInStream()
                        + ". Found "
                        + (char) nextToken);
              break;
            default:
              nextToken = reader.skip();
              break;
          }
        }
        if (nextToken != '}') {
          throw new java.io.IOException(
              "Expecting '}' at position "
                  + reader.positionInStream()
                  + ". Found "
                  + (char) nextToken);
        }
      }

      this.simples = _simples_;
    }