public static Object convertToObject()

in kernel/data-pipeline/scenario/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverter.java [55:98]


    public static Object convertToObject(final Any any) throws InvalidProtocolBufferException {
        if (null == any || any.is(Empty.class)) {
            return null;
        }
        if (any.is(StringValue.class)) {
            return any.unpack(StringValue.class).getValue();
        }
        if (any.is(Int32Value.class)) {
            return any.unpack(Int32Value.class).getValue();
        }
        if (any.is(Int64Value.class)) {
            return any.unpack(Int64Value.class).getValue();
        }
        if (any.is(Int64Value.class)) {
            return any.unpack(Int64Value.class).getValue();
        }
        if (any.is(UInt32Value.class)) {
            return any.unpack(UInt64Value.class).getValue();
        }
        if (any.is(UInt64Value.class)) {
            return any.unpack(UInt64Value.class).getValue();
        }
        if (any.is(FloatValue.class)) {
            return any.unpack(FloatValue.class).getValue();
        }
        if (any.is(DoubleValue.class)) {
            return any.unpack(DoubleValue.class).getValue();
        }
        if (any.is(BoolValue.class)) {
            return any.unpack(BoolValue.class).getValue();
        }
        if (any.is(BytesValue.class)) {
            return any.unpack(BytesValue.class).getValue().toByteArray();
        }
        if (any.is(com.google.protobuf.Timestamp.class)) {
            return converProtobufTimestamp(any.unpack(com.google.protobuf.Timestamp.class));
        }
        if (any.is(Struct.class)) {
            return JsonFormat.printer().print(any.unpack(Struct.class));
        }
        // TODO can't use JsonFormat, might change the original value without error prompt. there need to cover more types,
        log.error("not support unpack value={}", any);
        throw new UnsupportedOperationException(String.format("not support unpack the type %s", any.getTypeUrl()));
    }