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

com.networknt.oas.model.impl.HeaderImpl Maven / Gradle / Ivy

There is a newer version: 2.1.38
Show newest version
package com.networknt.oas.model.impl;

import com.fasterxml.jackson.databind.JsonNode;
import com.networknt.oas.jsonoverlay.*;
import com.networknt.oas.model.*;

import java.util.Map;

public class HeaderImpl extends OpenApiObjectImpl implements Header {


    public HeaderImpl(JsonNode json, JsonOverlay parent, ReferenceRegistry refReg) {
        super(json, parent, refReg);
        super.maybeElaborateChildrenAtCreation();
    }


    public HeaderImpl(Header header, JsonOverlay parent, ReferenceRegistry refReg) {
        super(header, parent, refReg);
        super.maybeElaborateChildrenAtCreation();
    }


    private ChildOverlay name = null;


    private ChildOverlay in = null;


    private ChildOverlay description = null;


    private ChildOverlay required = null;


    private ChildOverlay deprecated = null;


    private ChildOverlay allowEmptyValue = null;


    private ChildOverlay style = null;


    private ChildOverlay explode = null;


    private ChildOverlay allowReserved = null;


    private ChildOverlay schema = null;


    private ChildOverlay example = null;


    private ChildMapOverlay examples = null;


    private ChildMapOverlay contentMediaTypes = null;


    private ChildMapOverlay extensions = null;

    // Name
    @Override
    public String getName() {
        return name.get();
    }

    @Override
    public String getName(boolean elaborate) {
        return name.get(elaborate);
    }

    @Override
    public void setName(String name) {
        this.name.set(name);
    }

    // In
    @Override
    public String getIn() {
        return in.get();
    }

    @Override
    public String getIn(boolean elaborate) {
        return in.get(elaborate);
    }

    @Override
    public void setIn(String in) {
        this.in.set(in);
    }

    // Description
    @Override
    public String getDescription() {
        return description.get();
    }

    @Override
    public String getDescription(boolean elaborate) {
        return description.get(elaborate);
    }

    @Override
    public void setDescription(String description) {
        this.description.set(description);
    }

    // Required
    @Override
    public Boolean getRequired() {
        return required.get();
    }

    @Override
    public Boolean getRequired(boolean elaborate) {
        return required.get(elaborate);
    }

    @Override
    public boolean isRequired() {
        return required.get() != null ? required.get() : false;
    }

    @Override
    public void setRequired(Boolean required) {
        this.required.set(required);
    }

    // Deprecated
    @Override
    public Boolean getDeprecated() {
        return deprecated.get();
    }

    @Override
    public Boolean getDeprecated(boolean elaborate) {
        return deprecated.get(elaborate);
    }

    @Override
    public boolean isDeprecated() {
        return deprecated.get() != null ? deprecated.get() : false;
    }

    @Override
    public void setDeprecated(Boolean deprecated) {
        this.deprecated.set(deprecated);
    }

    // AllowEmptyValue
    @Override
    public Boolean getAllowEmptyValue() {
        return allowEmptyValue.get();
    }

    @Override
    public Boolean getAllowEmptyValue(boolean elaborate) {
        return allowEmptyValue.get(elaborate);
    }

    @Override
    public boolean isAllowEmptyValue() {
        return allowEmptyValue.get() != null ? allowEmptyValue.get() : false;
    }

    @Override
    public void setAllowEmptyValue(Boolean allowEmptyValue) {
        this.allowEmptyValue.set(allowEmptyValue);
    }

    // Style
    @Override
    public String getStyle() {
        return style.get();
    }

    @Override
    public String getStyle(boolean elaborate) {
        return style.get(elaborate);
    }

    @Override
    public void setStyle(String style) {
        this.style.set(style);
    }

    // Explode
    @Override
    public Boolean getExplode() {
        return explode.get();
    }

    @Override
    public Boolean getExplode(boolean elaborate) {
        return explode.get(elaborate);
    }

    @Override
    public boolean isExplode() {
        return explode.get() != null ? explode.get() : false;
    }

    @Override
    public void setExplode(Boolean explode) {
        this.explode.set(explode);
    }

    // AllowReserved
    @Override
    public Boolean getAllowReserved() {
        return allowReserved.get();
    }

    @Override
    public Boolean getAllowReserved(boolean elaborate) {
        return allowReserved.get(elaborate);
    }

    @Override
    public boolean isAllowReserved() {
        return allowReserved.get() != null ? allowReserved.get() : false;
    }

    @Override
    public void setAllowReserved(Boolean allowReserved) {
        this.allowReserved.set(allowReserved);
    }

    // Schema
    @Override
    public Schema getSchema() {
        return schema.get();
    }

    @Override
    public Schema getSchema(boolean elaborate) {
        return schema.get(elaborate);
    }

    @Override
    public void setSchema(Schema schema) {
        this.schema.set(schema);
    }

    @Override
    public boolean isSchemaReference() {
        return schema != null ? schema.isReference() : false;
    }

    @Override
    public Reference getSchemaReference() {
        return schema != null ? schema.getReference() : null;
    }

    // Example
    @Override
    public Object getExample() {
        return example.get();
    }

    @Override
    public Object getExample(boolean elaborate) {
        return example.get(elaborate);
    }

    @Override
    public void setExample(Object example) {
        this.example.set(example);
    }

    // Example
    @Override
    public Map getExamples() {
        return examples.get();
    }

    @Override
    public Map getExamples(boolean elaborate) {
        return examples.get(elaborate);
    }

    @Override
    public boolean hasExample(String name) {
        return examples.containsKey(name);
    }

    @Override
    public Example getExample(String name) {
        return examples.get(name);
    }

    @Override
    public void setExamples(Map examples) {
        this.examples.set(examples);
    }

    @Override
    public void setExample(String name, Example example) {
        examples.set(name, example);
    }

    @Override
    public void removeExample(String name) {
        examples.remove(name);
    }

    @Override
    public boolean isExampleReference(String key) {
        ChildOverlay child = examples.getChild(key);
        return child != null ? child.isReference() : false;
    }

    @Override
    public Reference getExampleReference(String key) {
        ChildOverlay child = examples.getChild(key);
        return child != null ? child.getReference() : null;
    }

    // ContentMediaType
    @Override
    public Map getContentMediaTypes() {
        return contentMediaTypes.get();
    }

    @Override
    public Map getContentMediaTypes(boolean elaborate) {
        return contentMediaTypes.get(elaborate);
    }

    @Override
    public boolean hasContentMediaType(String name) {
        return contentMediaTypes.containsKey(name);
    }

    @Override
    public MediaType getContentMediaType(String name) {
        return contentMediaTypes.get(name);
    }

    @Override
    public void setContentMediaTypes(Map contentMediaTypes) {
        this.contentMediaTypes.set(contentMediaTypes);
    }

    @Override
    public void setContentMediaType(String name, MediaType contentMediaType) {
        contentMediaTypes.set(name, contentMediaType);
    }

    @Override
    public void removeContentMediaType(String name) {
        contentMediaTypes.remove(name);
    }

    // Extension
    @Override
    public Map getExtensions() {
        return extensions.get();
    }

    @Override
    public Map getExtensions(boolean elaborate) {
        return extensions.get(elaborate);
    }

    @Override
    public boolean hasExtension(String name) {
        return extensions.containsKey(name);
    }

    @Override
    public Object getExtension(String name) {
        return extensions.get(name);
    }

    @Override
    public void setExtensions(Map extensions) {
        this.extensions.set(extensions);
    }

    @Override
    public void setExtension(String name, Object extension) {
        extensions.set(name, extension);
    }

    @Override
    public void removeExtension(String name) {
        extensions.remove(name);
    }

    @Override
    protected void elaborateChildren() {
        name = createChild("name", this, StringOverlay.factory);
        in = createChild("in", this, StringOverlay.factory);
        description = createChild("description", this, StringOverlay.factory);
        required = createChild("required", this, BooleanOverlay.factory);
        deprecated = createChild("deprecated", this, BooleanOverlay.factory);
        allowEmptyValue = createChild("allowEmptyValue", this, BooleanOverlay.factory);
        style = createChild("style", this, StringOverlay.factory);
        explode = createChild("explode", this, BooleanOverlay.factory);
        allowReserved = createChild("allowReserved", this, BooleanOverlay.factory);
        schema = createChild("schema", this, SchemaImpl.factory);
        refables.put("schema", schema);
        example = createChild("example", this, ObjectOverlay.factory);
        examples = createChildMap("examples", this, ExampleImpl.factory, "[a-zA-Z0-9\\._-]+");
        refables.put("examples", examples);
        contentMediaTypes = createChildMap("content", this, MediaTypeImpl.factory, null);
        extensions = createChildMap("", this, ObjectOverlay.factory, "x-.+");
    }


    public static OverlayFactory factory = new OverlayFactory() {
        @Override
        protected Class getOverlayClass() {
            return HeaderImpl.class;
        }

        @Override
        public HeaderImpl _create(Header header, JsonOverlay parent, ReferenceRegistry refReg) {
            return new HeaderImpl(header, parent, refReg);
        }

        @Override
        public HeaderImpl _create(JsonNode json, JsonOverlay parent, ReferenceRegistry refReg) {
            return new HeaderImpl(json, parent, refReg);
        }
    };

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy