001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package dev.metaschema.databind.io.json; 007 008import com.fasterxml.jackson.databind.node.ObjectNode; 009 010import dev.metaschema.core.model.IAnyContent; 011import edu.umd.cs.findbugs.annotations.NonNull; 012 013/** 014 * JSON/YAML-specific implementation of {@link IAnyContent} that stores captured 015 * unmodeled content as a Jackson {@link ObjectNode}. 016 */ 017public class JsonAnyContent implements IAnyContent { 018 @NonNull 019 private final ObjectNode properties; 020 021 /** 022 * Construct a new instance with the provided captured properties. 023 * 024 * @param properties 025 * the captured JSON properties, must not be null 026 */ 027 public JsonAnyContent(@NonNull ObjectNode properties) { 028 this.properties = properties; 029 } 030 031 @Override 032 public boolean isEmpty() { 033 return properties.isEmpty(); 034 } 035 036 /** 037 * Get the captured JSON properties. 038 * 039 * @return the captured ObjectNode 040 */ 041 @NonNull 042 public ObjectNode getProperties() { 043 return properties; 044 } 045}