The Exemplar Playground Java module provides practical, runnable examples demonstrating how to use the Expedia Group Java SDK for both REST and GraphQL APIs. It serves as a reference implementation, usage guide, and technical documentation for common SDK integration patterns.
This playground showcases the full capabilities of the Expedia Group Java SDK ecosystem through hands-on examples. It demonstrates how to build applications using the SDK's core features:
| Feature | Description |
|---|---|
| REST API Integration | Examples using the REST-based SDK to perform booking-related operations |
| GraphQL Support | GraphQL client usage through the generated SDK and Apollo integration |
| Async Programming | Demonstrates asynchronous execution with CompletableFuture |
| Custom Transport Layers | Shows how to build and plug in your own transport implementations |
| Error Handling | Illustrates structured exception handling for failed operations |
This playground interacts with the exemplar-server, which provides the REST and GraphQL endpoints used in the examples. Make sure it's up and running before you run the examples.
- Java 17 or higher
- Gradle 8.x
- exemplar-server running (see server setup)
| Dependency | Purpose | Documentation |
|---|---|---|
expediagroup-sdk-transport-okhttp |
Default HTTP transport layer | Transport OkHttp |
exemplar-sdk-rest |
Generated REST client SDK | Exemplar REST SDK |
exemplar-sdk-graphql |
Generated GraphQL client SDK | Exemplar GraphQL SDK |
log4j-slf4j2-impl |
Logging implementation | SLF4J-compatible logging backend |
The playground includes runnable examples to demonstrate different SDK features:
| Class | Description |
|---|---|
FullExemplarScenario |
Demonstrates a complete hotel booking flow using the REST API |
AsyncFullExemplarScenario |
Async version of the booking scenario |
HandleOperationException |
Error handling for REST API operations |
All classes are under the playground.rest package.
| Class | Description |
|---|---|
FullExemplarScenario |
Booking scenario using the GraphQL API |
AsyncFullExemplarScenario |
Async version of the booking scenario |
HandleOperationException |
Error handling for GraphQL operations |
All classes are under the playground.graphql package.
| Class | Description |
|---|---|
ConfigureOkHttpTransport |
How to configure and customize OkHttp transport |
CustomTransport |
Custom synchronous transport layer implementation |
CustomAsyncTransport |
Custom asynchronous transport layer implementation |
All classes are under the playground.common or root package.
- Exemplar Server: API server implementation
- Exemplar REST SDK: Generated REST client
- Exemplar GraphQL SDK: Generated GraphQL client
- SDK Core: Core SDK foundation
- SDK REST: REST client framework
- SDK Transport OkHttp: Default transport layer