public AsyncTransactionCreateBuilder create()

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


    public AsyncTransactionCreateBuilder create() {
        return new AsyncTransactionCreateBuilder() {
            private List<ACL> aclList = null;
            private CreateMode createMode = CreateMode.PERSISTENT;
            private boolean compressed = client.compressionEnabled();
            private long ttl = -1;

            @Override
            public AsyncPathAndBytesable<CuratorOp> withMode(CreateMode createMode) {
                this.createMode = Objects.requireNonNull(createMode, "createMode cannot be null");
                return this;
            }

            @Override
            public AsyncPathAndBytesable<CuratorOp> withACL(List<ACL> aclList) {
                this.aclList = aclList;
                return this;
            }

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

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

            @Override
            public AsyncPathAndBytesable<CuratorOp> withTtl(long ttl) {
                this.ttl = ttl;
                return this;
            }

            @Override
            public AsyncPathAndBytesable<CuratorOp> withOptions(
                    CreateMode createMode, List<ACL> aclList, boolean compressed) {
                return withOptions(createMode, aclList, compressed, ttl);
            }

            @Override
            public AsyncPathAndBytesable<CuratorOp> withOptions(
                    CreateMode createMode, List<ACL> aclList, boolean compressed, long ttl) {
                this.createMode = Objects.requireNonNull(createMode, "createMode cannot be null");
                this.aclList = aclList;
                this.compressed = compressed;
                this.ttl = ttl;
                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) {
                TransactionCreateBuilder2<CuratorOp> builder1 = (ttl > 0)
                        ? client.transactionOp().create().withTtl(ttl)
                        : client.transactionOp().create();
                ACLPathAndBytesable<CuratorOp> builder2 = compressed
                        ? builder1.compressed().withMode(createMode)
                        : builder1.uncompressed().withMode(createMode);
                PathAndBytesable<CuratorOp> builder3 = builder2.withACL(aclList);
                try {
                    return useData ? builder3.forPath(path, data) : builder3.forPath(path);
                } catch (Exception e) {
                    throw new RuntimeException(e); // should never happen
                }
            }
        };
    }