com.networknt.oas.model.impl.CallbackImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
A light-weight, fast OpenAPI 3.0 parser and validator
/*******************************************************************************
* Copyright (c) 2017 ModelSolv, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* ModelSolv, Inc. - initial API and implementation and/or initial documentation
*******************************************************************************/
package com.networknt.oas.model.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.networknt.jsonoverlay.*;
import com.networknt.oas.model.Callback;
import com.networknt.oas.model.OpenApi3;
import com.networknt.oas.model.Path;
import javax.annotation.Generated;
import java.util.Map;
public class CallbackImpl extends PropertiesOverlay implements Callback {
private Overlay overlay = Overlay.of(this);
@Override
public String getName() {
return overlay.getParent() instanceof MapOverlay> ? overlay.getPathInParent() : null;
}
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public CallbackImpl(JsonNode json, JsonOverlay> parent, ReferenceManager refMgr) {
super(json, parent, factory, refMgr);
}
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public CallbackImpl(Callback callback, JsonOverlay> parent, ReferenceManager refMgr) {
super(callback, parent, factory, refMgr);
}
// CallbackPath
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public Map getCallbackPaths() {
return _getMap("callbackPaths", Path.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public Map getCallbackPaths(boolean elaborate) {
return _getMap("callbackPaths", elaborate, Path.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public boolean hasCallbackPaths() {
return _isPresent("callbackPaths");
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public boolean hasCallbackPath(String expression) {
return _getMap("callbackPaths", Path.class).containsKey(expression);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public Path getCallbackPath(String expression) {
return _get("callbackPaths", expression, Path.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public void setCallbackPaths(Map callbackPaths) {
_setMap("callbackPaths", callbackPaths, Path.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public void setCallbackPath(String expression, Path callbackPath) {
_set("callbackPaths", expression, callbackPath, Path.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public void removeCallbackPath(String expression) {
_remove("callbackPaths", expression, Path.class);
}
// Extension
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public Map getExtensions() {
return _getMap("extensions", Object.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public Map getExtensions(boolean elaborate) {
return _getMap("extensions", elaborate, Object.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public boolean hasExtensions() {
return _isPresent("extensions");
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public boolean hasExtension(String name) {
return _getMap("extensions", Object.class).containsKey(name);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public Object getExtension(String name) {
return _get("extensions", name, Object.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public void setExtensions(Map extensions) {
_setMap("extensions", extensions, Object.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public void setExtension(String name, Object extension) {
_set("extensions", name, extension, Object.class);
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_callbackPaths = "callbackPaths";
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
super._elaborateJson();
_createMap("callbackPaths", "", PathImpl.factory, "(?!x-).*");
_createMap("extensions", "", ObjectOverlay.factory, "x-.+");
}
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static OverlayFactory factory = new OverlayFactory() {
@Override
protected Class extends JsonOverlay super Callback>> getOverlayClass() {
return CallbackImpl.class;
}
@Override
public JsonOverlay _create(Callback callback, JsonOverlay> parent, ReferenceManager refMgr) {
JsonOverlay> overlay;
overlay = new CallbackImpl(callback, parent, refMgr);
@SuppressWarnings("unchecked")
JsonOverlay castOverlay = (JsonOverlay) overlay;
return castOverlay;
}
@Override
public JsonOverlay _create(JsonNode json, JsonOverlay> parent, ReferenceManager refMgr) {
JsonOverlay> overlay;
overlay = new CallbackImpl(json, parent, refMgr);
@SuppressWarnings("unchecked")
JsonOverlay castOverlay = (JsonOverlay) overlay;
return castOverlay;
}
@Override
protected boolean isExtendedType() {
return false;
}
};
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
private static Class extends Callback> getSubtypeOf(Callback callback) {
return Callback.class;
}
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
private static Class extends Callback> getSubtypeOf(JsonNode json) {
return Callback.class;
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public Class> _getModelType() {
return OpenApi3.class;
}
@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected OverlayFactory> _getFactory() {
return factory;
}
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static > Builder builder(OV modelMember) {
return new Builder(factory, modelMember);
}
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static > Callback create(OV modelMember) {
return (Callback) builder(modelMember).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy