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