baku-toolkit/lib/src/main/java/io/v/rx/syncbase/SyncbaseEntity.java
/**
     * Utility for Syncbase entities with lazy creation semantics. It would be great if this were
     * instead factored into a V23 interface and utility.
     *
     * @return a future that completes with {@code true} if this call created the entity,
     * {@code false} if the entity already existed, or fails if an unexpected error occurred.
     */
Utility for Syncbase entities with lazy creation semantics. It would be great if this were
instead factored into a V23 interface and utility.

@return a future that completes with  true if this call created the entity,
false if the entity already existed, or fails if an unexpected error occurred.
Utility for Syncbase entities with lazy creation semantics . It would be great if this were instead factored into a V23 interface and utility . @return a future that completes with true if this call created the entity false if the entity already existed or fails if an unexpected error occurred .
public FluentFuture<Boolean> ensureExists(final VContext vContext,
                                              final Permissions permissions) {
        return FluentFutures.from(exists(vContext))
                .transform((AsyncFunction<Boolean, Boolean>) (e -> e ?
                        Futures.immediateFuture(false) :
                        FluentFutures.from(create(vContext, permissions))
                                .transform((Function<Void, Boolean>) (x -> true))
                                .withFallback(t -> t instanceof ExistException ?
                                        Futures.<Boolean>immediateFuture(false) :
                                        Futures.<Boolean>immediateFailedFuture(t))
                ));
    }
public FluentFuture < Boolean > ensureExists ( final VContext vContext , final Permissions permissions ) { return FluentFutures . from ( exists ( vContext ) ) . transform ( ( AsyncFunction < Boolean , Boolean > ) ( e -> e ? Futures . immediateFuture ( false ) : FluentFutures . from ( create ( vContext , permissions ) ) . transform ( ( Function < Void , Boolean > ) ( x -> true ) ) . withFallback ( t -> t instanceof ExistException ? Futures . < Boolean > immediateFuture ( false ) : Futures . < Boolean > immediateFailedFuture ( t ) ) ) ) ; }
Utility for Syncbase entities with lazy creation semantics.
Utility for Syncbase entities with lazy creation semantics .