Class OASFactory

java.lang.Object
org.eclipse.microprofile.openapi.OASFactory

public final class OASFactory extends Object
This class allows application developers to build new OpenAPI model elements.

For example, to start a new top-level OpenAPI element with an ExternalDocument inside of it an application developer would write:
OASFactory.createObject(OpenAPI.class)
          .setExternalDocs(OASFactory.createObject(ExternalDocumentation.class).url("http://myDoc"));
  • Method Details

    • createObject

      public static <T extends Constructible> T createObject(Class<T> clazz)
      This method creates a new instance of a constructible element from the OpenAPI model tree.

      Example:
      OASFactory.createObject(Info.class).title("Airlines").description("Airlines APIs").version("1.0.0");
       
      Type Parameters:
      T - describes the type parameter
      Parameters:
      clazz - represents a model which extends the Constructible interface
      Returns:
      a new instance of the requested model class
      Throws:
      NullPointerException - if the specified class is null
      IllegalArgumentException - if an instance could not be created, most likely, due to an illegal or inappropriate class
    • createComponents

      public static Components createComponents()
      This method creates a new Components instance.
      Returns:
      a new Components instance
    • createExternalDocumentation

      public static ExternalDocumentation createExternalDocumentation()
      This method creates a new ExternalDocumentation instance.
      Returns:
      a new ExternalDocumentation instance
    • createOpenAPI

      public static OpenAPI createOpenAPI()
      This method creates a new OpenAPI instance.
      Returns:
      a new OpenAPI instance
    • createOperation

      public static Operation createOperation()
      This method creates a new Operation instance.
      Returns:
      a new Operation instance
    • createPathItem

      public static PathItem createPathItem()
      This method creates a new PathItem instance.
      Returns:
      a new PathItem instance
    • createPaths

      public static Paths createPaths()
      This method creates a new Paths instance.
      Returns:
      a new Paths instance
    • createCallback

      public static Callback createCallback()
      This method creates a new Callback instance.
      Returns:
      a new Callback instance
    • createExample

      public static Example createExample()
      This method creates a new Example instance.
      Returns:
      a new Example instance
    • createHeader

      public static Header createHeader()
      This method creates a new Header instance.
      Returns:
      a new Header instance
    • createContact

      public static Contact createContact()
      This method creates a new Contact instance.
      Returns:
      a new Contact instance
    • createInfo

      public static Info createInfo()
      This method creates a new Info instance.
      Returns:
      a new Info instance
    • createLicense

      public static License createLicense()
      This method creates a new License instance.
      Returns:
      a new License instance
    • createLink

      public static Link createLink()
      This method creates a new Link instance.
      Returns:
      a new Link instance
    • createContent

      public static Content createContent()
      This method creates a new Content instance.
      Returns:
      a new Content instance
    • createDiscriminator

      public static Discriminator createDiscriminator()
      This method creates a new Discriminator instance.
      Returns:
      a new Discriminator instance
    • createEncoding

      public static Encoding createEncoding()
      This method creates a new Encoding instance.
      Returns:
      a new Encoding instance
    • createMediaType

      public static MediaType createMediaType()
      This method creates a new MediaType instance.
      Returns:
      a new MediaType instance
    • createSchema

      public static Schema createSchema()
      This method creates a new Schema instance.
      Returns:
      a new Schema instance
    • createXML

      public static XML createXML()
      This method creates a new XML instance.
      Returns:
      a new XML instance
    • createParameter

      public static Parameter createParameter()
      This method creates a new Parameter instance.
      Returns:
      a new Parameter instance
    • createRequestBody

      public static RequestBody createRequestBody()
      This method creates a new RequestBody instance.
      Returns:
      a new RequestBody instance
    • createAPIResponse

      public static APIResponse createAPIResponse()
      This method creates a new APIResponse instance.
      Returns:
      a new APIResponse instance
    • createAPIResponses

      public static APIResponses createAPIResponses()
      This method creates a new APIResponses instance.
      Returns:
      a new APIResponses instance
    • createOAuthFlow

      public static OAuthFlow createOAuthFlow()
      This method creates a new OAuthFlow instance.
      Returns:
      a new OAuthFlow instance
    • createOAuthFlows

      public static OAuthFlows createOAuthFlows()
      This method creates a new OAuthFlows instance.
      Returns:
      a new OAuthFlows instance
    • createSecurityRequirement

      public static SecurityRequirement createSecurityRequirement()
      This method creates a new SecurityRequirement instance.
      Returns:
      a new SecurityRequirement instance
    • createSecurityScheme

      public static SecurityScheme createSecurityScheme()
      This method creates a new SecurityScheme instance.
      Returns:
      a new SecurityScheme instance
    • createServer

      public static Server createServer()
      This method creates a new Server instance.
      Returns:
      a new Server instance
    • createServerVariable

      public static ServerVariable createServerVariable()
      This method creates a new ServerVariable instance.
      Returns:
      a new ServerVariable instance
    • createTag

      public static Tag createTag()
      This method creates a new Tag instance.
      Returns:
      a new Tag instance