001/******************************************************************************* 002 * Copyright (c) 2017 Red Hat Inc 003 * All rights reserved. This program and the accompanying materials 004 * are made available under the terms of the Eclipse Public License v1.0 005 * which accompanies this distribution, and is available at 006 * http://www.eclipse.org/legal/epl-v10.html 007 * 008 * Contributors: 009 * Jens Reimann - initial API and implementation 010 *******************************************************************************/ 011package de.dentrassi.varlink; 012 013import java.util.concurrent.CompletableFuture; 014 015import de.dentrassi.varlink.spi.Syncer; 016 017public interface Resolver { 018 019 public interface Sync { 020 public <T> T resolve(Class<T> clazz); 021 } 022 023 public interface Async { 024 public <T> CompletableFuture<T> resolve(Class<T> clazz); 025 } 026 027 public Async async(); 028 029 public default Sync sync() { 030 return new Sync() { 031 032 @Override 033 public <T> T resolve(final Class<T> clazz) { 034 return Syncer.await(async().resolve(clazz)); 035 } 036 }; 037 } 038}