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

io.apicurio.datamodels.models.openapi.v20.OpenApi20DocumentImpl Maven / Gradle / Ivy

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

import com.fasterxml.jackson.databind.JsonNode;
import io.apicurio.datamodels.models.Info;
import io.apicurio.datamodels.models.ModelType;
import io.apicurio.datamodels.models.Node;
import io.apicurio.datamodels.models.RootNodeImpl;
import io.apicurio.datamodels.models.openapi.OpenApiExternalDocumentation;
import io.apicurio.datamodels.models.openapi.OpenApiPaths;
import io.apicurio.datamodels.models.openapi.OpenApiSecurityRequirement;
import io.apicurio.datamodels.models.openapi.OpenApiTag;
import io.apicurio.datamodels.models.openapi.v20.visitors.OpenApi20Visitor;
import io.apicurio.datamodels.models.visitors.Visitor;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class OpenApi20DocumentImpl extends RootNodeImpl implements OpenApi20Document {

	private String swagger;
	private Info info;
	private String host;
	private String basePath;
	private List schemes;
	private List consumes;
	private List produces;
	private OpenApiPaths paths;
	private OpenApi20Definitions definitions;
	private OpenApi20ParameterDefinitions parameters;
	private OpenApi20ResponseDefinitions responses;
	private OpenApi20SecurityDefinitions securityDefinitions;
	private List security;
	private List tags;
	private OpenApiExternalDocumentation externalDocs;
	private Map extensions;

	public OpenApi20DocumentImpl() {
		super(ModelType.OPENAPI20);
	}

	@Override
	public String getSwagger() {
		return swagger;
	}

	@Override
	public void setSwagger(String value) {
		this.swagger = value;
	}

	@Override
	public Info getInfo() {
		return info;
	}

	@Override
	public void setInfo(Info value) {
		this.info = value;
	}

	@Override
	public OpenApi20Info createInfo() {
		OpenApi20InfoImpl node = new OpenApi20InfoImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public String getHost() {
		return host;
	}

	@Override
	public void setHost(String value) {
		this.host = value;
	}

	@Override
	public String getBasePath() {
		return basePath;
	}

	@Override
	public void setBasePath(String value) {
		this.basePath = value;
	}

	@Override
	public List getSchemes() {
		return schemes;
	}

	@Override
	public void setSchemes(List value) {
		this.schemes = value;
	}

	@Override
	public List getConsumes() {
		return consumes;
	}

	@Override
	public void setConsumes(List value) {
		this.consumes = value;
	}

	@Override
	public List getProduces() {
		return produces;
	}

	@Override
	public void setProduces(List value) {
		this.produces = value;
	}

	@Override
	public OpenApiPaths getPaths() {
		return paths;
	}

	@Override
	public void setPaths(OpenApiPaths value) {
		this.paths = value;
	}

	@Override
	public OpenApi20Paths createPaths() {
		OpenApi20PathsImpl node = new OpenApi20PathsImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public OpenApi20Definitions getDefinitions() {
		return definitions;
	}

	@Override
	public void setDefinitions(OpenApi20Definitions value) {
		this.definitions = value;
	}

	@Override
	public OpenApi20Definitions createDefinitions() {
		OpenApi20DefinitionsImpl node = new OpenApi20DefinitionsImpl();
		node.setParent(this);
		return node;
	}

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

	@Override
	public void setParameters(OpenApi20ParameterDefinitions value) {
		this.parameters = value;
	}

	@Override
	public OpenApi20ParameterDefinitions createParameterDefinitions() {
		OpenApi20ParameterDefinitionsImpl node = new OpenApi20ParameterDefinitionsImpl();
		node.setParent(this);
		return node;
	}

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

	@Override
	public void setResponses(OpenApi20ResponseDefinitions value) {
		this.responses = value;
	}

	@Override
	public OpenApi20ResponseDefinitions createResponseDefinitions() {
		OpenApi20ResponseDefinitionsImpl node = new OpenApi20ResponseDefinitionsImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public OpenApi20SecurityDefinitions getSecurityDefinitions() {
		return securityDefinitions;
	}

	@Override
	public void setSecurityDefinitions(OpenApi20SecurityDefinitions value) {
		this.securityDefinitions = value;
	}

	@Override
	public OpenApi20SecurityDefinitions createSecurityDefinitions() {
		OpenApi20SecurityDefinitionsImpl node = new OpenApi20SecurityDefinitionsImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public OpenApi20SecurityRequirement createSecurityRequirement() {
		OpenApi20SecurityRequirementImpl node = new OpenApi20SecurityRequirementImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public List getSecurity() {
		return security;
	}

	@Override
	public void addSecurity(OpenApiSecurityRequirement value) {
		if (this.security == null) {
			this.security = new ArrayList<>();
		}
		this.security.add(value);
	}

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

	@Override
	public void removeSecurity(OpenApiSecurityRequirement value) {
		if (this.security != null) {
			this.security.remove(value);
		}
	}

	@Override
	public OpenApi20Tag createTag() {
		OpenApi20TagImpl node = new OpenApi20TagImpl();
		node.setParent(this);
		return node;
	}

	@Override
	public List getTags() {
		return tags;
	}

	@Override
	public void addTag(OpenApiTag value) {
		if (this.tags == null) {
			this.tags = new ArrayList<>();
		}
		this.tags.add(value);
	}

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

	@Override
	public void removeTag(OpenApiTag value) {
		if (this.tags != null) {
			this.tags.remove(value);
		}
	}

	@Override
	public OpenApiExternalDocumentation getExternalDocs() {
		return externalDocs;
	}

	@Override
	public void setExternalDocs(OpenApiExternalDocumentation value) {
		this.externalDocs = value;
	}

	@Override
	public OpenApi20ExternalDocumentation createExternalDocumentation() {
		OpenApi20ExternalDocumentationImpl node = new OpenApi20ExternalDocumentationImpl();
		node.setParent(this);
		return node;
	}

	@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) {
		OpenApi20Visitor viz = (OpenApi20Visitor) visitor;
		viz.visitDocument(this);
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy