Package org.eclipse.microprofile.openapi
Class OASFactory
java.lang.Object
org.eclipse.microprofile.openapi.OASFactory
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:
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
Modifier and TypeMethodDescriptionstatic <T extends Constructible>
TcreateObject(Class<T> clazz) This method creates a new instance of a constructible element from the OpenAPI model tree.
-
Method Details
-
createObject
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 theConstructibleinterface- Returns:
- a new instance of the requested model class
- Throws:
NullPointerException- if the specified class is nullIllegalArgumentException- if an instance could not be created, most likely, due to an illegal or inappropriate class
-