com.networknt.jsonoverlay.BooleanOverlay Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-overlay Show documentation
Show all versions of json-overlay Show documentation
A fork of RepreZen JsonOverlay with all dependencies and code generation removed
/*********************************************************************
* Copyright (c) 2017 ModelSolv, Inc. and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ModelSolv, Inc.
* - initial API and implementation and/or initial documentation
**********************************************************************/
package com.networknt.jsonoverlay;
import com.fasterxml.jackson.databind.JsonNode;
public final class BooleanOverlay extends ScalarOverlay {
private BooleanOverlay(Boolean value, JsonOverlay> parent, ReferenceManager refMgr) {
super(value, parent, factory, refMgr);
}
private BooleanOverlay(JsonNode json, JsonOverlay> parent, ReferenceManager refMgr) {
super(json, parent, factory, refMgr);
}
@Override
protected Boolean _fromJson(JsonNode json) {
return json.isBoolean() ? json.booleanValue() : null;
}
@Override
protected JsonNode _toJsonInternal(SerializationOptions options) {
return value != null ? _jsonBoolean(value) : _jsonMissing();
}
@Override
protected OverlayFactory _getFactory() {
return factory;
}
public static OverlayFactory factory = new OverlayFactory() {
@Override
protected Class getOverlayClass() {
return BooleanOverlay.class;
}
@Override
public BooleanOverlay _create(Boolean value, JsonOverlay> parent, ReferenceManager refMgr) {
return new BooleanOverlay(value, parent, refMgr);
}
@Override
public BooleanOverlay _create(JsonNode json, JsonOverlay> parent, ReferenceManager refMgr) {
return new BooleanOverlay(json, parent, refMgr);
}
};
public static Builder builder(JsonOverlay> modelMember) {
return new Builder(factory, modelMember);
}
public static JsonOverlay create(JsonOverlay> modelMember) {
return builder(modelMember).build();
}
public static JsonOverlay create(boolean value, JsonOverlay> modelMember) {
JsonOverlay result = create(modelMember);
result._set(value);
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy