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 2017-2020 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.json.bind;
import io.micronaut.context.BeanProvider;
import io.micronaut.context.annotation.Primary;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.bind.BeanPropertyBinder;
import io.micronaut.core.convert.ArgumentConversionContext;
import io.micronaut.core.convert.ConversionError;
import io.micronaut.core.convert.exceptions.ConversionErrorException;
import io.micronaut.core.type.Argument;
import io.micronaut.core.util.CollectionUtils;
import io.micronaut.core.util.StringUtils;
import io.micronaut.json.JsonConfiguration;
import io.micronaut.json.JsonMapper;
import io.micronaut.json.tree.JsonNode;
import jakarta.inject.Singleton;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
/**
* An {@link io.micronaut.core.bind.ArgumentBinder} capable of binding from an object from a map.
*
* @author Graeme Rocher
* @since 1.0
*/
@Internal
@Singleton
@Primary
final class JsonBeanPropertyBinder implements BeanPropertyBinder {
private final JsonMapper jsonMapper;
private final int arraySizeThreshold;
private final BeanProvider exceptionHandlers;
/**
* @param jsonMapper To read/write JSON
* @param configuration The configuration for Jackson JSON parser
* @param exceptionHandlers Exception handlers for binding exceptions
*/
JsonBeanPropertyBinder(JsonMapper jsonMapper, JsonConfiguration configuration, BeanProvider exceptionHandlers) {
this.jsonMapper = jsonMapper;
this.arraySizeThreshold = configuration.getArraySizeThreshold();
this.exceptionHandlers = exceptionHandlers;
}
@Override
public BindingResult