A Java client for the AdoptOpenJDK REST API.
JVM | Platform | Status |
---|---|---|
OpenJDK LTS | Linux | |
OpenJDK Current | Linux | |
OpenJDK Current | Windows |
- Efficient, type-safe access to the AdoptOpenJDK API
- Clean API/implementation separation for easy API mocking in applications
- JPMS-ready
- OSGi-ready
- High coverage automated test suite
- Apache 2.0 license
- Fully documented (JavaDOC)
Use the following Maven dependencies:
<dependency>
<groupId>net.adoptopenjdk</groupId>
<artifactId>net.adoptopenjdk.v3.api</artifactId>
<version><!-- Insert latest version --></version>
</dependency>
<dependency>
<groupId>net.adoptopenjdk</groupId>
<artifactId>net.adoptopenjdk.v3.vanilla</artifactId>
<version><!-- Insert latest version --></version>
</dependency>
The first dependency specifies that you want to use the API, and the second is a basic provider for the API.
Then:
var clients = new AOV3Clients();
try (var client = clients.createClient()) {
var request = client.availableReleases(...);
var releases = request.execute();
}
The API operates entirely synchronously and raises checked exceptions on failures.
The net.adoptopenjdk.v3.api.AOV3ClientProviderType
interface is published
both as a JPMS service and an OSGi service in order to
allow for decoupling consumers from the vanilla
implementation package:
var clients =
ServiceLoader.load(AOV3ClientProviderType.class)
.findFirst()
.orElseThrow(() -> new IllegalStateException(
String.format("No implementations of %s are available", AOV3ClientProviderType.class)));
try (var client = clients.createClient()) {
var request = client.availableReleases(...);
var releases = request.execute();
}