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
7 package wtf
.metio
.yosql
.models
.configuration
;
9 import com
.fasterxml
.jackson
.databind
.annotation
.JsonDeserialize
;
10 import com
.fasterxml
.jackson
.databind
.annotation
.JsonSerialize
;
11 import com
.squareup
.javapoet
.TypeName
;
12 import de
.xn__ho_hia
.javapoet
.TypeGuesser
;
13 import org
.immutables
.value
.Value
;
15 import java
.util
.Optional
;
19 as
= ImmutableResultRowConverter
.class
22 as
= ImmutableResultRowConverter
.class
24 public interface ResultRowConverter
{
28 static ImmutableResultRowConverter
.Builder
builder() {
29 return ImmutableResultRowConverter
.builder();
35 * @return The (short) alias of this converter.
37 Optional
<String
> alias();
40 * @return The fully-qualified type name of this converter.
42 Optional
<String
> converterType();
45 * @return The name of the method to use while converting values.
47 Optional
<String
> methodName();
50 * @return The fully-qualified result type of this converter.
52 Optional
<String
> resultType();
57 default Optional
<TypeName
> resultTypeName() {
58 return resultType().map(TypeGuesser
::guessTypeName
);
62 default Optional
<TypeName
> converterTypeName() {
63 return converterType().map(TypeGuesser
::guessTypeName
);