public AsyncTransactionSetDataBuilder setData()

in curator-x-async/src/main/java/org/apache/curator/x/async/details/AsyncTransactionOpImpl.java [152:212]


    public AsyncTransactionSetDataBuilder setData() {
        return new AsyncTransactionSetDataBuilder() {
            private int version = -1;
            private boolean compressed = client.compressionEnabled();

            @Override
            public AsyncPathAndBytesable<CuratorOp> withVersion(int version) {
                this.version = version;
                return this;
            }

            @Override
            public AsyncPathAndBytesable<CuratorOp> compressed() {
                compressed = true;
                return this;
            }

            @Override
            public AsyncPathAndBytesable<CuratorOp> uncompressed() {
                compressed = false;
                return this;
            }

            @Override
            public AsyncPathAndBytesable<CuratorOp> withVersionCompressed(int version) {
                this.version = version;
                compressed = true;
                return this;
            }

            @Override
            public AsyncPathAndBytesable<CuratorOp> withVersionUncompressed(int version) {
                this.version = version;
                compressed = false;
                return this;
            }

            @Override
            public CuratorOp forPath(String path, byte[] data) {
                return internalForPath(path, data, true);
            }

            @Override
            public CuratorOp forPath(String path) {
                return internalForPath(path, null, false);
            }

            private CuratorOp internalForPath(String path, byte[] data, boolean useData) {
                TransactionSetDataBuilder<CuratorOp> builder1 =
                        client.transactionOp().setData();
                VersionPathAndBytesable<CuratorOp> builder2 =
                        compressed ? builder1.compressed() : builder1.uncompressed();
                PathAndBytesable<CuratorOp> builder3 = builder2.withVersion(version);
                try {
                    return useData ? builder3.forPath(path, data) : builder3.forPath(path);
                } catch (Exception e) {
                    throw new RuntimeException(e); // should never happen
                }
            }
        };
    }