Pet.java
public class Pet
A class that contains necessary nested request body classes
- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType
- records which implement SealedMediaType, the concrete media types
- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances
- SealedRequestBody, a sealed interface which contains all the contentType/schema input types
- records which implement SealedRequestBody, the concrete request body types
| Modifier and Type | Class and Description |
|---|---|
| sealed interface | Pet.SealedMediaType media type sealed interface |
| record | Pet.ApplicationjsonMediaType record storing schema + encoding for a specific contentType |
| record | Pet.ApplicationxmlMediaType record storing schema + encoding for a specific contentType |
| static class | Pet.Pet1 class that serializes request bodies |
| sealed interface | Pet.SealedRequestBody request body sealed interface |
| record | Pet.ApplicationjsonRequestBody implements sealed interface to store request body input |
| record | Pet.ApplicationxmlRequestBody implements sealed interface to store request body input |
public sealed interface SealedMediaType
permits
ApplicationjsonMediaType,
ApplicationxmlMediaType
sealed interface that stores schema and encoding info
public record ApplicationjsonMediaType
implements SealedMediaType, MediaType<ApplicationjsonSchema.ApplicationjsonSchema1, Void>
class storing schema info for a specific contentType
| Constructor and Description |
|---|
| ApplicationjsonMediaType() Creates an instance |
| Modifier and Type | Method and Description |
|---|---|
| ApplicationjsonSchema.ApplicationjsonSchema1 | schema() the schema for this MediaType |
| Void | encoding() the encoding info |
public record ApplicationxmlMediaType
implements SealedMediaType, MediaType<ApplicationxmlSchema.ApplicationxmlSchema1, Void>
class storing schema info for a specific contentType
| Constructor and Description |
|---|
| ApplicationxmlMediaType() Creates an instance |
| Modifier and Type | Method and Description |
|---|---|
| ApplicationxmlSchema.ApplicationxmlSchema1 | schema() the schema for this MediaType |
| Void | encoding() the encoding info |
public static class Pet1
a class that serializes SealedRequestBody request bodies
| Constructor and Description |
|---|
| Pet1() Creates an instance |
| Modifier and Type | Field and Description |
|---|---|
| boolean | required = true whether the request body is required |
| Map<String, SealedMediaType> | content = Map.ofEntries( new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()) ) the contentType to schema info |
| Modifier and Type | Method and Description |
|---|---|
| SerializedRequestBody | serialize(SealedRequestBody requestBody) called by endpoint when creating request body bytes |
public sealed interface SealedRequestBody
permits
ApplicationjsonRequestBody,
ApplicationxmlRequestBody
sealed interface that stores request contentType + validated schema data
public record ApplicationjsonRequestBody
implements SealedRequestBody,
GenericRequestBody<ApplicationjsonSchema.Pet1Boxed>
A record class to store request body input for contentType="application/json"
| Constructor and Description |
|---|
| ApplicationjsonRequestBody(ApplicationjsonSchema.Pet1Boxed body) Creates an instance |
| Modifier and Type | Method and Description |
|---|---|
| String | contentType() always returns "application/json" |
| ApplicationjsonSchema.Pet1Boxed | body() returns the body passed in in the constructor |
public record ApplicationxmlRequestBody
implements SealedRequestBody,
GenericRequestBody<ApplicationxmlSchema.Pet1Boxed>
A record class to store request body input for contentType="application/xml"
| Constructor and Description |
|---|
| ApplicationxmlRequestBody(ApplicationxmlSchema.Pet1Boxed body) Creates an instance |
| Modifier and Type | Method and Description |
|---|---|
| String | contentType() always returns "application/xml" |
| ApplicationxmlSchema.Pet1Boxed | body() returns the body passed in in the constructor |
[Back to top] [Back to Component RequestBodies] [Back to README]