/** {@inheritDoc} */
  @Override
  public boolean readFrom(ByteBuffer buf, MessageReader reader) {
    reader.setBuffer(buf);

    if (!reader.beforeMessageRead()) return false;

    switch (reader.state()) {
      case 0:
        pageSize = reader.readInt("pageSize");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 1:
        qrys = reader.readCollection("qrys", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 2:
        reqId = reader.readLong("reqId");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 3:
        space = reader.readString("space");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 4:
        topVer = reader.readMessage("topVer");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 5:
        extraSpaces = reader.readCollection("extraSpaces", MessageCollectionItemType.STRING);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 6:
        parts = reader.readIntArray("parts");

        if (!reader.isLastRead()) return false;

        reader.incrementState();
    }

    return reader.afterMessageRead(GridQueryRequest.class);
  }
  /** {@inheritDoc} */
  @Override
  public boolean readFrom(ByteBuffer buf, MessageReader reader) {
    reader.setBuffer(buf);

    if (!reader.beforeMessageRead()) return false;

    if (!super.readFrom(buf, reader)) return false;

    switch (reader.state()) {
      case 3:
        ack = reader.readBoolean("ack");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 4:
        infos =
            reader.readMap(
                "infos", MessageCollectionItemType.INT, MessageCollectionItemType.MSG, false);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 5:
        last = reader.readCollection("last", MessageCollectionItemType.INT);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 6:
        missed = reader.readCollection("missed", MessageCollectionItemType.INT);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 7:
        updateSeq = reader.readLong("updateSeq");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 8:
        workerId = reader.readInt("workerId");

        if (!reader.isLastRead()) return false;

        reader.incrementState();
    }

    return reader.afterMessageRead(GridDhtPartitionSupplyMessage.class);
  }
  /** {@inheritDoc} */
  @Override
  public boolean readFrom(ByteBuffer buf, MessageReader reader) {
    reader.setBuffer(buf);

    if (!reader.beforeMessageRead()) return false;

    if (!super.readFrom(buf, reader)) return false;

    switch (reader.state()) {
      case 0:
        fileId = reader.readIgniteUuid("fileId");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 1:
        fragmentRanges = reader.readCollection("fragmentRanges", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();
    }

    return true;
  }
  /** {@inheritDoc} */
  @Override
  public boolean readFrom(ByteBuffer buf, MessageReader reader) {
    reader.setBuffer(buf);

    if (!reader.beforeMessageRead()) return false;

    if (!super.readFrom(buf, reader)) return false;

    switch (reader.state()) {
      case 10:
        dhtVer = reader.readMessage("dhtVer");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 11:
        filterFailedKeys = reader.readCollection("filterFailedKeys", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 12:
        futId = reader.readIgniteUuid("futId");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 13:
        invalidParts = reader.readCollection("invalidParts", MessageCollectionItemType.INT);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 14:
        miniId = reader.readIgniteUuid("miniId");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 15:
        ownedValKeys = reader.readCollection("ownedValKeys", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 16:
        ownedValVals = reader.readCollection("ownedValVals", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 17:
        pending = reader.readCollection("pending", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 18:
        retVal = reader.readMessage("retVal");

        if (!reader.isLastRead()) return false;

        reader.incrementState();
    }

    return true;
  }
  /** {@inheritDoc} */
  @Override
  public boolean readFrom(ByteBuffer buf, MessageReader reader) {
    reader.setBuffer(buf);

    if (!reader.beforeMessageRead()) return false;

    if (!super.readFrom(buf, reader)) return false;

    switch (reader.state()) {
      case 3:
        conflictExpireTimes = reader.readMessage("conflictExpireTimes");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 4:
        conflictTtls = reader.readMessage("conflictTtls");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 5:
        conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 6:
        entryProcessorsBytes =
            reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 7:
        expiryPlcBytes = reader.readByteArray("expiryPlcBytes");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 8:
        fastMap = reader.readBoolean("fastMap");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 9:
        filter =
            reader.readObjectArray(
                "filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 10:
        futVer = reader.readMessage("futVer");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 11:
        hasPrimary = reader.readBoolean("hasPrimary");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 12:
        invokeArgsBytes =
            reader.readObjectArray(
                "invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 13:
        keys = reader.readCollection("keys", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 14:
        byte opOrd;

        opOrd = reader.readByte("op");

        if (!reader.isLastRead()) return false;

        op = GridCacheOperation.fromOrdinal(opOrd);

        reader.incrementState();

      case 15:
        retval = reader.readBoolean("retval");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 16:
        skipStore = reader.readBoolean("skipStore");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 17:
        subjId = reader.readUuid("subjId");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 18:
        byte syncModeOrd;

        syncModeOrd = reader.readByte("syncMode");

        if (!reader.isLastRead()) return false;

        syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);

        reader.incrementState();

      case 19:
        taskNameHash = reader.readInt("taskNameHash");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 20:
        topVer = reader.readMessage("topVer");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 21:
        updateVer = reader.readMessage("updateVer");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 22:
        vals = reader.readCollection("vals", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();
    }

    return true;
  }
  /** {@inheritDoc} */
  @Override
  public boolean readFrom(ByteBuffer buf, MessageReader reader) {
    reader.setBuffer(buf);

    if (!reader.beforeMessageRead()) return false;

    if (!super.readFrom(buf, reader)) return false;

    switch (reader.state()) {
      case 8:
        byte concurrencyOrd;

        concurrencyOrd = reader.readByte("concurrency");

        if (!reader.isLastRead()) return false;

        concurrency = TransactionConcurrency.fromOrdinal(concurrencyOrd);

        reader.incrementState();

      case 9:
        dhtVerKeys = reader.readCollection("dhtVerKeys", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 10:
        dhtVerVals = reader.readCollection("dhtVerVals", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 11:
        grpLockKeyBytes = reader.readByteArray("grpLockKeyBytes");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 12:
        invalidate = reader.readBoolean("invalidate");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 13:
        byte isolationOrd;

        isolationOrd = reader.readByte("isolation");

        if (!reader.isLastRead()) return false;

        isolation = TransactionIsolation.fromOrdinal(isolationOrd);

        reader.incrementState();

      case 14:
        onePhaseCommit = reader.readBoolean("onePhaseCommit");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 15:
        partLock = reader.readBoolean("partLock");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 16:
        byte plcOrd;

        plcOrd = reader.readByte("plc");

        if (!reader.isLastRead()) return false;

        plc = GridIoPolicy.fromOrdinal(plcOrd);

        reader.incrementState();

      case 17:
        reads = reader.readCollection("reads", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 18:
        sys = reader.readBoolean("sys");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 19:
        threadId = reader.readLong("threadId");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 20:
        timeout = reader.readLong("timeout");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 21:
        txNodesBytes = reader.readByteArray("txNodesBytes");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 22:
        txSize = reader.readInt("txSize");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 23:
        writeVer = reader.readMessage("writeVer");

        if (!reader.isLastRead()) return false;

        reader.incrementState();

      case 24:
        writes = reader.readCollection("writes", MessageCollectionItemType.MSG);

        if (!reader.isLastRead()) return false;

        reader.incrementState();
    }

    return true;
  }