Class OASFactory



  • public final class OASFactory
    extends java.lang.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 Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends Constructible>
      T
      createObject​(java.lang.Class<T> clazz)
      This method creates a new instance of a constructible element from the OpenAPI model tree.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createObject

        public static <T extends Constructible> T createObject​(java.lang.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:
        java.lang.NullPointerException - if the specified class is null
        java.lang.IllegalArgumentException - if an instance could not be created, most likely, due to an illegal or inappropriate class