docs: public final CachedData encode(Object o) {
      byte[] b = null;
      int flags = 0;
      if (o instanceof String) {
        b = encodeString((String) o);
      } else if (o instanceof Long) {
        if (this.primitiveAsString) {
          b = encodeString(o.toString());
        } else {
          b = this.transcoderUtils.encodeLong((Long) o);
        }
        flags |= SPECIAL_LONG;
      } else if (o instanceof Integer) {
        if (this.primitiveAsString) {
          b = encodeString(o.toString());
        } else {
          b = this.transcoderUtils.encodeInt((Integer) o);
        }
        flags |= SPECIAL_INT;
      } else if (o instanceof Boolean) {
        if (this.primitiveAsString) {
          b = encodeString(o.toString());
        } else {
          b = this.transcoderUtils.encodeBoolean((Boolean) o);
        }
        flags |= SPECIAL_BOOLEAN;
      } else if (o instanceof Date) {
        b = this.transcoderUtils.encodeLong(((Date) o).getTime());
        flags |= SPECIAL_DATE;
      } else if (o instanceof Byte) {
        if (this.primitiveAsString) {
          b = encodeString(o.toString());
        } else {
          b = this.transcoderUtils.encodeByte((Byte) o);
        }
        flags |= SPECIAL_BYTE;
      } else if (o instanceof Float) {
        if (this.primitiveAsString) {
          b = encodeString(o.toString());
        } else {
          b = this.transcoderUtils.encodeInt(Float.floatToRawIntBits((Float) o));
        }
        flags |= SPECIAL_FLOAT;
      } else if (o instanceof Double) {
        if (this.primitiveAsString) {
          b = encodeString(o.toString());
        } else {
          b = this.transcoderUtils.encodeLong(Double.doubleToRawLongBits((Double) o));
        }
        flags |= SPECIAL_DOUBLE;
      } else if (o instanceof byte[]) {
        b = (byte[]) o;
        flags |= SPECIAL_BYTEARRAY;
      } else {
        b = serialize(o);
        flags |= SERIALIZED;
      }
      assert b != null;
      if (this.primitiveAsString) {
        // It is not be SERIALIZED,so change it to string type
        if ((flags & SERIALIZED) == 0) {
          flags = 0;
        }
      }