Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.json.bind;
import jakarta.json.bind.adapter.JsonbAdapter;
import jakarta.json.bind.config.PropertyNamingStrategy;
import jakarta.json.bind.config.PropertyVisibilityStrategy;
import jakarta.json.bind.serializer.JsonbDeserializer;
import jakarta.json.bind.serializer.JsonbSerializer;
import java.lang.reflect.Array;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
/**
*
*
* Supported Properties
*
*
* All JSON Binding providers are required to support the following set of properties.
* Some providers may support additional properties.
*
*
jsonb.to.json.formatted - java.lang.Boolean
*
Controls whether or not the {@link jakarta.json.bind.Jsonb Jsonb} {@code toJson()}
* methods will format the resulting JSON data with line breaks and indentation. A
* true value for this property indicates human readable indented
* data, while a false value indicates unformatted data.
* Default value is false (unformatted) if this property is not specified.
*
*
*
jsonb.to.json.encoding - java.lang.String
*
The {@link jakarta.json.bind.Jsonb Jsonb} serialization {@code toJson()} methods
* will default to this property for encoding of output JSON data. Default
* value is 'UTF-8' if this property is not specified.
*
*
*
jsonb.from.json.encoding - java.lang.String
*
The {@link jakarta.json.bind.Jsonb Jsonb} deserialization {@code fromJson()}
* methods will default to this property encoding of input JSON data if the
* encoding cannot be detected.
*
*
*
* This object is not thread safe. Implementations are expected to make a defensive copy
* of the object before applying the configuration.
*
* @since JSON Binding 1.0
*/
public class JsonbConfig {
private final Map configuration = new HashMap<>();
/**
* Property used to specify whether or not the serialized
* JSON data is formatted with line feeds and indentation.
*/
public static final String FORMATTING = "jsonb.formatting";
/**
* The Jsonb serialization {@code toJson()} methods will default to this property
* for encoding of output JSON data. Default value is 'UTF-8'.
*
* The Jsonb deserialization {@code fromJson()} methods will default to this
* property encoding of input JSON data if the encoding cannot be detected
* automatically.
*/
public static final String ENCODING = "jsonb.encoding";
/**
* Property used to specify custom naming strategy.
*/
public static final String PROPERTY_NAMING_STRATEGY = "jsonb.property-naming-strategy";
/**
* Property used to specify custom order strategy.
*/
public static final String PROPERTY_ORDER_STRATEGY = "jsonb.property-order-strategy";
/**
* Property used to specify null values serialization behavior.
*/
public static final String NULL_VALUES = "jsonb.null-values";
/**
* Property used to specify strict I-JSON serialization compliance.
*/
public static final String STRICT_IJSON = "jsonb.strict-ijson";
/**
* Property used to specify custom visibility strategy.
*/
public static final String PROPERTY_VISIBILITY_STRATEGY = "jsonb.property-visibility-strategy";
/**
* Property used to specify custom mapping adapters for generic types.
*/
public static final String ADAPTERS = "jsonb.adapters";
/**
* Property used to specify custom serializers.
*/
public static final String SERIALIZERS = "jsonb.serializers";
/**
* Property used to specify custom deserializers.
*/
public static final String DESERIALIZERS = "jsonb.derializers";
/**
* Property used to specify custom binary data strategy.
*/
public static final String BINARY_DATA_STRATEGY = "jsonb.binary-data-strategy";
/**
* Property used to specify custom date format globally.
*/
public static final String DATE_FORMAT = "jsonb.date-format";
/**
* Property used to specify locale globally.
*/
public static final String LOCALE = "jsonb.locale";
/**
* Set the particular configuration property to a new value. The method can
* only be used to set one of the standard JSON Binding properties defined in
* this class or a provider specific property.
*
* @param name
* The name of the property to be set. This value can either
* be specified using one of the constant fields or a user supplied
* string.
* @param value
* The value of the property to be set
*
* @return This JsonbConfig instance.
*
* @throws NullPointerException if the name parameter is null.
*/
public final JsonbConfig setProperty(final String name, final Object value) {
configuration.put(name, value);
return this;
}
/**
* Return value of particular configuration property. The method can
* only be used to retrieve one of the standard JSON Binding properties defined
* in this class or a provider specific property. Attempting to get an undefined
* property will result in an empty Optional value.
* See Supported Properties.
*
* @param name
* The name of the property to retrieve
*
* @return The value of the requested property
*
* @throws NullPointerException if the name parameter is null.
*/
public final Optional