Skip to content

Latest commit

 

History

History
131 lines (102 loc) · 6.4 KB

File metadata and controls

131 lines (102 loc) · 6.4 KB

Pet

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

Nested Class Summary

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

SealedMediaType

public sealed interface SealedMediaType
permits
ApplicationjsonMediaType, ApplicationxmlMediaType

sealed interface that stores schema and encoding info

ApplicationjsonMediaType

public record ApplicationjsonMediaType
implements SealedMediaType, MediaType<ApplicationjsonSchema.ApplicationjsonSchema1, Void>

class storing schema info for a specific contentType

Constructor Summary

Constructor and Description
ApplicationjsonMediaType()
Creates an instance

Method Summary

Modifier and Type Method and Description
ApplicationjsonSchema.ApplicationjsonSchema1 schema()
the schema for this MediaType
Void encoding()
the encoding info

ApplicationxmlMediaType

public record ApplicationxmlMediaType
implements SealedMediaType, MediaType<ApplicationxmlSchema.ApplicationxmlSchema1, Void>

class storing schema info for a specific contentType

Constructor Summary

Constructor and Description
ApplicationxmlMediaType()
Creates an instance

Method Summary

Modifier and Type Method and Description
ApplicationxmlSchema.ApplicationxmlSchema1 schema()
the schema for this MediaType
Void encoding()
the encoding info

Pet1

public static class Pet1

a class that serializes SealedRequestBody request bodies

Constructor Summary

Constructor and Description
Pet1()
Creates an instance

Field Summary

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

Method Summary

Modifier and Type Method and Description
SerializedRequestBody serialize(SealedRequestBody requestBody)
called by endpoint when creating request body bytes

SealedRequestBody

public sealed interface SealedRequestBody
permits
ApplicationjsonRequestBody, ApplicationxmlRequestBody

sealed interface that stores request contentType + validated schema data

ApplicationjsonRequestBody

public record ApplicationjsonRequestBody
implements SealedRequestBody,
GenericRequestBody<ApplicationjsonSchema.Pet1Boxed>

A record class to store request body input for contentType="application/json"

Constructor Summary

Constructor and Description
ApplicationjsonRequestBody(ApplicationjsonSchema.Pet1Boxed body)
Creates an instance

Method Summary

Modifier and Type Method and Description
String contentType()
always returns "application/json"
ApplicationjsonSchema.Pet1Boxed body()
returns the body passed in in the constructor

ApplicationxmlRequestBody

public record ApplicationxmlRequestBody
implements SealedRequestBody,
GenericRequestBody<ApplicationxmlSchema.Pet1Boxed>

A record class to store request body input for contentType="application/xml"

Constructor Summary

Constructor and Description
ApplicationxmlRequestBody(ApplicationxmlSchema.Pet1Boxed body)
Creates an instance

Method Summary

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]