/**
     * @param flags Flags.
     * @return String builder containing all flags.
     */
    static String toString(short flags) {
      SB sb = new SB();

      for (Mask m : MASKS) {
        if (m.ordinal() != 0) sb.a('|');

        sb.a(m.name().toLowerCase()).a('=').a(m.bit(flags));
      }

      return sb.toString();
    }
  /** {@inheritDoc} */
  @Override
  public String toString() {
    GridCacheMvccCandidate<?> prev = previous();
    GridCacheMvccCandidate<?> next = next();

    return S.toString(
        GridCacheMvccCandidate.class,
        this,
        "key",
        parent == null ? null : parent.key(),
        "masks",
        Mask.toString(flags()),
        "prevVer",
        (prev == null ? null : prev.version()),
        "nextVer",
        (next == null ? null : next.version()));
  }
 /**
  * Sets mask value.
  *
  * @param mask Mask.
  * @param on Flag.
  */
 private void mask(Mask mask, boolean on) {
   flags = mask.set(flags, on);
 }