All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.apicurio.datamodels.models.openapi.v31.OpenApi31ComponentsImpl Maven / Gradle / Ivy

The newest version!
package io.apicurio.datamodels.models.openapi.v31;

import com.fasterxml.jackson.databind.JsonNode;
import io.apicurio.datamodels.models.Node;
import io.apicurio.datamodels.models.NodeImpl;
import io.apicurio.datamodels.models.Parameter;
import io.apicurio.datamodels.models.Schema;
import io.apicurio.datamodels.models.SecurityScheme;
import io.apicurio.datamodels.models.openapi.OpenApiCallback;
import io.apicurio.datamodels.models.openapi.OpenApiExample;
import io.apicurio.datamodels.models.openapi.OpenApiHeader;
import io.apicurio.datamodels.models.openapi.OpenApiLink;
import io.apicurio.datamodels.models.openapi.OpenApiRequestBody;
import io.apicurio.datamodels.models.openapi.OpenApiResponse;
import io.apicurio.datamodels.models.openapi.v31.visitors.OpenApi31Visitor;
import io.apicurio.datamodels.models.visitors.Visitor;
import java.util.LinkedHashMap;
import java.util.Map;

public class OpenApi31ComponentsImpl extends NodeImpl implements OpenApi31Components {

	private Map schemas;
	private Map responses;
	private Map parameters;
	private Map examples;
	private Map requestBodies;
	private Map headers;
	private Map securitySchemes;
	private Map links;
	private Map callbacks;
	private Map pathItems;
	private Map extensions;

	@Override
	public OpenApi31Schema createSchema() {
		OpenApi31SchemaImpl node = new OpenApi31SchemaImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getSchemas() {
		return schemas;
	}

	@Override
	public void addSchema(String name, Schema value) {
		if (this.schemas == null) {
			this.schemas = new LinkedHashMap<>();
		}
		this.schemas.put(name, value);
	}

	@Override
	public void clearSchemas() {
		if (this.schemas != null) {
			this.schemas.clear();
		}
	}

	@Override
	public void removeSchema(String name) {
		if (this.schemas != null) {
			this.schemas.remove(name);
		}
	}

	@Override
	public OpenApi31Response createResponse() {
		OpenApi31ResponseImpl node = new OpenApi31ResponseImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getResponses() {
		return responses;
	}

	@Override
	public void addResponse(String name, OpenApiResponse value) {
		if (this.responses == null) {
			this.responses = new LinkedHashMap<>();
		}
		this.responses.put(name, value);
	}

	@Override
	public void clearResponses() {
		if (this.responses != null) {
			this.responses.clear();
		}
	}

	@Override
	public void removeResponse(String name) {
		if (this.responses != null) {
			this.responses.remove(name);
		}
	}

	@Override
	public OpenApi31Parameter createParameter() {
		OpenApi31ParameterImpl node = new OpenApi31ParameterImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getParameters() {
		return parameters;
	}

	@Override
	public void addParameter(String name, Parameter value) {
		if (this.parameters == null) {
			this.parameters = new LinkedHashMap<>();
		}
		this.parameters.put(name, value);
	}

	@Override
	public void clearParameters() {
		if (this.parameters != null) {
			this.parameters.clear();
		}
	}

	@Override
	public void removeParameter(String name) {
		if (this.parameters != null) {
			this.parameters.remove(name);
		}
	}

	@Override
	public OpenApi31Example createExample() {
		OpenApi31ExampleImpl node = new OpenApi31ExampleImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getExamples() {
		return examples;
	}

	@Override
	public void addExample(String name, OpenApiExample value) {
		if (this.examples == null) {
			this.examples = new LinkedHashMap<>();
		}
		this.examples.put(name, value);
	}

	@Override
	public void clearExamples() {
		if (this.examples != null) {
			this.examples.clear();
		}
	}

	@Override
	public void removeExample(String name) {
		if (this.examples != null) {
			this.examples.remove(name);
		}
	}

	@Override
	public OpenApi31RequestBody createRequestBody() {
		OpenApi31RequestBodyImpl node = new OpenApi31RequestBodyImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getRequestBodies() {
		return requestBodies;
	}

	@Override
	public void addRequestBody(String name, OpenApiRequestBody value) {
		if (this.requestBodies == null) {
			this.requestBodies = new LinkedHashMap<>();
		}
		this.requestBodies.put(name, value);
	}

	@Override
	public void clearRequestBodies() {
		if (this.requestBodies != null) {
			this.requestBodies.clear();
		}
	}

	@Override
	public void removeRequestBody(String name) {
		if (this.requestBodies != null) {
			this.requestBodies.remove(name);
		}
	}

	@Override
	public OpenApi31Header createHeader() {
		OpenApi31HeaderImpl node = new OpenApi31HeaderImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getHeaders() {
		return headers;
	}

	@Override
	public void addHeader(String name, OpenApiHeader value) {
		if (this.headers == null) {
			this.headers = new LinkedHashMap<>();
		}
		this.headers.put(name, value);
	}

	@Override
	public void clearHeaders() {
		if (this.headers != null) {
			this.headers.clear();
		}
	}

	@Override
	public void removeHeader(String name) {
		if (this.headers != null) {
			this.headers.remove(name);
		}
	}

	@Override
	public OpenApi31SecurityScheme createSecurityScheme() {
		OpenApi31SecuritySchemeImpl node = new OpenApi31SecuritySchemeImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getSecuritySchemes() {
		return securitySchemes;
	}

	@Override
	public void addSecurityScheme(String name, SecurityScheme value) {
		if (this.securitySchemes == null) {
			this.securitySchemes = new LinkedHashMap<>();
		}
		this.securitySchemes.put(name, value);
	}

	@Override
	public void clearSecuritySchemes() {
		if (this.securitySchemes != null) {
			this.securitySchemes.clear();
		}
	}

	@Override
	public void removeSecurityScheme(String name) {
		if (this.securitySchemes != null) {
			this.securitySchemes.remove(name);
		}
	}

	@Override
	public OpenApi31Link createLink() {
		OpenApi31LinkImpl node = new OpenApi31LinkImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getLinks() {
		return links;
	}

	@Override
	public void addLink(String name, OpenApiLink value) {
		if (this.links == null) {
			this.links = new LinkedHashMap<>();
		}
		this.links.put(name, value);
	}

	@Override
	public void clearLinks() {
		if (this.links != null) {
			this.links.clear();
		}
	}

	@Override
	public void removeLink(String name) {
		if (this.links != null) {
			this.links.remove(name);
		}
	}

	@Override
	public OpenApi31Callback createCallback() {
		OpenApi31CallbackImpl node = new OpenApi31CallbackImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getCallbacks() {
		return callbacks;
	}

	@Override
	public void addCallback(String name, OpenApiCallback value) {
		if (this.callbacks == null) {
			this.callbacks = new LinkedHashMap<>();
		}
		this.callbacks.put(name, value);
	}

	@Override
	public void clearCallbacks() {
		if (this.callbacks != null) {
			this.callbacks.clear();
		}
	}

	@Override
	public void removeCallback(String name) {
		if (this.callbacks != null) {
			this.callbacks.remove(name);
		}
	}

	@Override
	public OpenApi31PathItem createPathItem() {
		OpenApi31PathItemImpl node = new OpenApi31PathItemImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public Map getPathItems() {
		return pathItems;
	}

	@Override
	public void addPathItem(String name, OpenApi31PathItem value) {
		if (this.pathItems == null) {
			this.pathItems = new LinkedHashMap<>();
		}
		this.pathItems.put(name, value);
	}

	@Override
	public void clearPathItems() {
		if (this.pathItems != null) {
			this.pathItems.clear();
		}
	}

	@Override
	public void removePathItem(String name) {
		if (this.pathItems != null) {
			this.pathItems.remove(name);
		}
	}

	@Override
	public Map getExtensions() {
		return extensions;
	}

	@Override
	public void addExtension(String name, JsonNode value) {
		if (this.extensions == null) {
			this.extensions = new LinkedHashMap<>();
		}
		this.extensions.put(name, value);
	}

	@Override
	public void clearExtensions() {
		if (this.extensions != null) {
			this.extensions.clear();
		}
	}

	@Override
	public void removeExtension(String name) {
		if (this.extensions != null) {
			this.extensions.remove(name);
		}
	}

	@Override
	public void accept(Visitor visitor) {
		OpenApi31Visitor viz = (OpenApi31Visitor) visitor;
		viz.visitComponents(this);
	}

	@Override
	public Node emptyClone() {
		return new OpenApi31ComponentsImpl();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy