Skip to content

Instantly share code, notes, and snippets.

@aslakknutsen
Created February 26, 2016 08:35
Show Gist options
  • Save aslakknutsen/2452f126eb428bca7a95 to your computer and use it in GitHub Desktop.
Save aslakknutsen/2452f126eb428bca7a95 to your computer and use it in GitHub Desktop.
// API
public interface CubeController {
<T> T createContainerObject(Class<T> containerClass);
}
// CORE
public interface CubeControllerClient {
@Inject
private Instance<ServiceLoader> loader;
public <T> T createContainerObject(Class<T> containerClass) {
T container = loader.onlyOne(ContainerObjectCreator.class).create(containerClass);
for(TestEnricher enricher : loader.all(TestEnrichers.class)) {
enricher.enrich(container);
}
return container;
}
}
// SPI
public interface ContainerObjectCreator {
<T> T create(Class<T> container);
}
// DOCKER
public class DockerContainerObjectCreator implements ContainerObjectCreator{
<T> T create(Class<T> container) {
return goMagic()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment