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

com.networknt.oas.model.impl.CallbackImpl 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.Callback;
import com.networknt.oas.model.OpenApi3;
import com.networknt.oas.model.Path;

import java.util.Map;

public class CallbackImpl extends OpenApiObjectImpl implements Callback {


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


    public CallbackImpl(Callback callback, JsonOverlay parent, ReferenceRegistry refReg) {
        super(callback, parent, refReg);
        super.maybeElaborateChildrenAtCreation();
    }


    private ChildMapOverlay callbackPaths = null;


    private ChildMapOverlay extensions = null;

    // CallbackPath
    @Override
    public Map getCallbackPaths() {
        return callbackPaths.get();
    }

    @Override
    public Map getCallbackPaths(boolean elaborate) {
        return callbackPaths.get(elaborate);
    }

    @Override
    public boolean hasCallbackPath(String expression) {
        return callbackPaths.containsKey(expression);
    }

    @Override
    public Path getCallbackPath(String expression) {
        return callbackPaths.get(expression);
    }

    @Override
    public void setCallbackPaths(Map callbackPaths) {
        this.callbackPaths.set(callbackPaths);
    }

    @Override
    public void setCallbackPath(String expression, Path callbackPath) {
        callbackPaths.set(expression, callbackPath);
    }

    @Override
    public void removeCallbackPath(String expression) {
        callbackPaths.remove(expression);
    }

    // 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() {
        callbackPaths = createChildMap("", this, PathImpl.factory, "(?!x-).*");
        extensions = createChildMap("", this, ObjectOverlay.factory, "x-.+");
    }

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

        @Override
        public CallbackImpl _create(Callback callback, JsonOverlay parent, ReferenceRegistry refReg) {
            return new CallbackImpl(callback, parent, refReg);
        }

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy