001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package dev.metaschema.databind.io; 007 008import dev.metaschema.core.configuration.AbstractConfigurationFeature; 009import edu.umd.cs.findbugs.annotations.NonNull; 010 011/** 012 * Configuration features that control the serialization behavior of 013 * Metaschema-bound object writers. 014 * <p> 015 * Each feature has a default value that can be overridden when configuring a 016 * serializer. 017 * 018 * @param <V> 019 * the value type of the configuration feature 020 */ 021public final class SerializationFeature<V> 022 extends AbstractConfigurationFeature<V> { 023 /** 024 * If enabled, generate document level constructs in the underlying data format. 025 * In XML this would include XML declarations. In JSON or YAML, this would 026 * include an outer object and field with the name associated with the root 027 * node. 028 */ 029 @NonNull 030 public static final SerializationFeature<Boolean> SERIALIZE_ROOT 031 = new SerializationFeature<>("serialize-root", Boolean.class, true); 032 033 /** 034 * Construct a new serialization feature. 035 * 036 * @param name 037 * the feature name used for identification 038 * @param valueClass 039 * the class of the feature value type 040 * @param defaultValue 041 * the default value for this feature 042 */ 043 private SerializationFeature( 044 @NonNull String name, 045 @NonNull Class<V> valueClass, 046 @NonNull V defaultValue) { 047 super(name, valueClass, defaultValue); 048 } 049}