ResultConsumerLoader { public CompletableFuture<Boolean> set() { if(key == null && filter == null) { CompletableFuture<Boolean> ready = new CompletableFuture<>(); ready.complete(true); globalPlacer.accept(consumer); return ready; } else { return placer.apply(this); } } ResultConsumerLoader(
			Function<ResultConsumerLoader<K,OUT>,CompletableFuture<Boolean>> placer,
			Consumer<ResultConsumer <K,OUT>> globalPlacer,
			ResultConsumer <K,OUT> consumer
			); private  ResultConsumerLoader(
			Function<ResultConsumerLoader<K,OUT>,CompletableFuture<Boolean>> placer, 
			Consumer<ResultConsumer <K,OUT>> globalPlacer,
			long creationTime,
			long expirationTime,
			long ttlMsec,
			K key, 
			ResultConsumer <K,OUT> consumer,
			SerializablePredicate<K> filter,
			Map<String,Object> properties,
			long priority); private  ResultConsumerLoader(
			Function<ResultConsumerLoader<K,OUT>,CompletableFuture<Boolean>> placer, 
			Consumer<ResultConsumer <K,OUT>> globalPlacer,
			long creationTime,
			long ttlMsec,
			K key, 
			ResultConsumer <K,OUT> consumer,
			SerializablePredicate<K> filter,
			Map<String,Object> properties,
			long priority,
			boolean dumb); ResultConsumerLoader<K,OUT> id(K k); ResultConsumerLoader<K,OUT> foreach(SerializablePredicate<K> f); ResultConsumerLoader<K,OUT> foreach(); ResultConsumerLoader<K,OUT> first(ResultConsumer <K,OUT> consumer); ResultConsumerLoader<K,OUT> expirationTime(long et); ResultConsumerLoader<K,OUT> creationTime(long ct); ResultConsumerLoader<K,OUT> expirationTime(Instant instant); ResultConsumerLoader<K,OUT> creationTime(Instant instant); ResultConsumerLoader<K,OUT> priority(long p); ResultConsumerLoader<K,OUT> ttl(long time, TimeUnit unit); ResultConsumerLoader<K,OUT> ttl(Duration duration); ResultConsumerLoader<K,OUT> andThen(ResultConsumer <K,OUT> consumer); ResultConsumerLoader<K,OUT> before(ResultConsumer <K,OUT> consumer); ResultConsumerLoader<K,OUT> clearProperties(); ResultConsumerLoader<K,OUT> clearProperty(String k); ResultConsumerLoader<K,OUT> addProperty(String k, Object v); ResultConsumerLoader<K,OUT> addProperties(Map<String,Object> moreProperties); X getProperty(String key, Class<X> cls); Map<String,Object> getAllProperties(); CompletableFuture<Boolean> set(); @Override String toString(); static ResultConsumerLoader<K,OUT> byConveyorName(String name); static ResultConsumerLoader<K,OUT> byConveyorName(String name,ResultConsumer<K,OUT> consumer); static Supplier<ResultConsumerLoader<K,OUT>> lazySupplier(String name); final K key; final ResultConsumer <K,OUT> consumer; final Function<ResultConsumerLoader<K,OUT>,CompletableFuture<Boolean>> placer; final long creationTime; final long expirationTime; final long ttlMsec; final SerializablePredicate<K> filter; final long priority; }
@Test public void testResultConsumerPlain() throws InterruptedException, ExecutionException { ResultConsumerLoader<Integer, String> rc = new ResultConsumerLoader<>(rcl->{ System.out.println("For Key "+rcl); return null; }, this::consumer, bin->{ System.out.println("Default "+bin); defaultInteger = 1; defaultString = "DEFAULT_1"; }); CompletableFuture<Boolean> f = rc.set(); assertNotNull(f); assertTrue(f.get()); assertEquals(Integer.valueOf(1), defaultInteger); assertEquals("DEFAULT_1", defaultString); }