2 * This file is part of yosql. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at https://creativecommons.org/publicdomain/zero/1.0/. No part of yosql,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
8 package wtf
.metio
.yosql
.codegen
.files
;
10 import com
.fasterxml
.jackson
.core
.JsonParser
;
11 import com
.fasterxml
.jackson
.databind
.DeserializationContext
;
12 import com
.fasterxml
.jackson
.databind
.JsonDeserializer
;
13 import wtf
.metio
.yosql
.internals
.jdk
.Strings
;
14 import wtf
.metio
.yosql
.models
.configuration
.SqlParameter
;
16 import java
.io
.IOException
;
18 public final class SqlParameterDeserializer
extends JsonDeserializer
<SqlParameter
> {
21 public SqlParameter
deserialize(
22 final JsonParser jsonParser
,
23 final DeserializationContext context
) throws IOException
{
24 final var parameter
= jsonParser
.readValueAs(Parameter
.class);
25 return SqlParameter
.builder()
26 .setName(Strings
.isBlank(parameter
.name
) ?
"" : parameter
.name
)
27 .setType(Strings
.isBlank(parameter
.type
) ?
"" : parameter
.type
)
28 .setIndices(parameter
.indices
== null ?
new int[0] : parameter
.indices
)
29 .setConverter(Strings
.isBlank(parameter
.converter
) ?
"" : parameter
.converter
)
33 private static final class Parameter
{
36 public String converter
;