/** {@inheritDoc} */
 @Override
 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
   clsLdrId = U.readGridUuid(in);
   depMode = DeploymentMode.fromOrdinal(in.readByte());
   userVer = U.readString(in);
   locDepOwner = in.readBoolean();
   participants = U.readMap(in);
 }
  /** {@inheritDoc} */
  @Override
  public boolean readFrom(ByteBuffer buf, MessageReader reader) {
    reader.setBuffer(buf);

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

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

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

        reader.incrementState();

      case 1:
        byte depModeOrd;

        depModeOrd = reader.readByte("depMode");

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

        depMode = DeploymentMode.fromOrdinal(depModeOrd);

        reader.incrementState();

      case 2:
        locDepOwner = reader.readBoolean("locDepOwner");

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

        reader.incrementState();

      case 3:
        participants =
            reader.readMap(
                "participants",
                MessageCollectionItemType.UUID,
                MessageCollectionItemType.IGNITE_UUID,
                false);

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

        reader.incrementState();

      case 4:
        userVer = reader.readString("userVer");

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

        reader.incrementState();
    }

    return reader.afterMessageRead(GridDeploymentInfoBean.class);
  }
  /** {@inheritDoc} */
  @Override
  public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
    writer.setBuffer(buf);

    if (!writer.isHeaderWritten()) {
      if (!writer.writeHeader(directType(), fieldsCount())) return false;

      writer.onHeaderWritten();
    }

    switch (writer.state()) {
      case 0:
        if (!writer.writeIgniteUuid("clsLdrId", clsLdrId)) return false;

        writer.incrementState();

      case 1:
        if (!writer.writeByte("depMode", depMode != null ? (byte) depMode.ordinal() : -1))
          return false;

        writer.incrementState();

      case 2:
        if (!writer.writeBoolean("locDepOwner", locDepOwner)) return false;

        writer.incrementState();

      case 3:
        if (!writer.writeMap(
            "participants",
            participants,
            MessageCollectionItemType.UUID,
            MessageCollectionItemType.IGNITE_UUID)) return false;

        writer.incrementState();

      case 4:
        if (!writer.writeString("userVer", userVer)) return false;

        writer.incrementState();
    }

    return true;
  }