Top Description Inners Fields Constructors Methods
io.r2dbc.pool

pack-priv final Class OptionMapper

extends Object
Class Inheritance
Imports
io.r2dbc.spi.ConnectionFactoryOptions, .Option, java.time.Duration, java.util.Locale, java.util.function.Consumer, .Function, .Supplier

An utility data parser for Option.
Authors
Rodolpho S. Couto, Mark Paluch
Since
0.9

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static enum
public static interface

Field Summary

Modifier and TypeField and Description
private final ConnectionFactoryOptions

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static OptionMapper

Returns:

the option mapper.
create
(ConnectionFactoryOptions
must not be null.
options
)

Construct a new OptionMapper given ConnectionFactoryOptions.

public <T> OptionMapper.Source<Object>

Returns:

the source object.
from
(Option<?> option)

Construct a new Source for a Option.

public <T> OptionMapper.Source<T>

Returns:

the source object.
fromExact
(Option<T> option)

Construct a new Source for a Option assuming the option value uses the exact option type.

pack-priv static boolean
toBoolean(Object value)

Parse an Option to boolean.

pack-priv static Duration
toDuration(Object value)

Parse an ISO-8601 formatted Option to Duration.

pack-priv static <T extends Enum<T>> T
toEnum(Object value, Class<T> enumType)

Parse an Option to Enum.

pack-priv static int
toInteger(Object value)

Parse an Option to int.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

optionsback to summary
private final ConnectionFactoryOptions options

Constructor Detail

OptionMapperback to summary
private OptionMapper(ConnectionFactoryOptions options)

Method Detail

createback to summary
public static OptionMapper create(ConnectionFactoryOptions options)

Construct a new OptionMapper given ConnectionFactoryOptions.

Parameters
options:ConnectionFactoryOptions

must not be null.

Returns:OptionMapper

the option mapper.

fromback to summary
public <T> OptionMapper.Source<Object> from(Option<?> option)

Construct a new Source for a Option. Options without a value are not bound or mapped in the later stages of Source.

Returns:OptionMapper.Source<Object>

the source object.

fromExactback to summary
public <T> OptionMapper.Source<T> fromExact(Option<T> option)

Construct a new Source for a Option assuming the option value uses the exact option type. Options without a value are not bound or mapped in the later stages of Source.

Returns:OptionMapper.Source<T>

the source object.

Annotations
@SuppressWarnings:unchecked
Since
0.9
toBooleanback to summary
pack-priv static boolean toBoolean(Object value)

Parse an Option to boolean.

toDurationback to summary
pack-priv static Duration toDuration(Object value)

Parse an ISO-8601 formatted Option to Duration.

toEnumback to summary
pack-priv static <T extends Enum<T>> T toEnum(Object value, Class<T> enumType)

Parse an Option to Enum.

Annotations
@SuppressWarnings:unchecked
toIntegerback to summary
pack-priv static int toInteger(Object value)

Parse an Option to int.

io.r2dbc.pool back to summary

private Class OptionMapper.AvailableSource<T>

extends Object
implements OptionMapper.Source<T>
Class Inheritance
All Implemented Interfaces
io.r2dbc.pool.OptionMapper.Source

Field Summary

Modifier and TypeField and Description
private final String
private final Supplier<T>

Constructor Summary

AccessConstructor and Description
private
AvailableSource(Supplier<T> supplier, String optionName)

Method Summary

Modifier and TypeMethod and Description
public <
the resulting type.
R
>
OptionMapper.Source<R>

Returns:

a new mapped source instance.
as
(Function<Object, R>
the mapping function to apply.
mappingFunction
)

Implements io.r2dbc.pool.OptionMapper.Source.as.

Return an mapped version of the source changed via the given mapping function.
public void
to(Consumer<T>
the consumer that should accept the value.
consumer
)

Implements io.r2dbc.pool.OptionMapper.Source.to.

Complete the mapping by passing any non-filtered value to the specified consumer.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

optionNameback to summary
private final String optionName
supplierback to summary
private final Supplier<T> supplier

Constructor Detail

AvailableSourceback to summary
private AvailableSource(Supplier<T> supplier, String optionName)

Method Detail

asback to summary
public <R> OptionMapper.Source<R> as(Function<Object, R> mappingFunction)

Implements io.r2dbc.pool.OptionMapper.Source.as.

Return an mapped version of the source changed via the given mapping function.

Parameters
<R>
the resulting type.
mappingFunction:Function<Object, R>

the mapping function to apply.

Returns:OptionMapper.Source<R>

a new mapped source instance.

Annotations
@Override
toback to summary
public void to(Consumer<T> consumer)

Implements io.r2dbc.pool.OptionMapper.Source.to.

Complete the mapping by passing any non-filtered value to the specified consumer.

Parameters
consumer:Consumer<T>

the consumer that should accept the value.

Annotations
@Override
io.r2dbc.pool back to summary

private final Enum OptionMapper.NullSource

extends Enum<OptionMapper.NullSource>
implements OptionMapper.Source<Object>
Class Inheritance
All Implemented Interfaces
io.r2dbc.pool.OptionMapper.Source
Annotations
@SuppressWarnings:unchecked, rawtypes

Field Summary

Modifier and TypeField and Description
public static final OptionMapper.NullSource

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public <R> OptionMapper.Source<R>
as(Function<Object, R>
the mapping function to apply
mappingFunction
)

Implements io.r2dbc.pool.OptionMapper.Source.as.

Return an mapped version of the source changed via the given mapping function.
public static <T> OptionMapper.Source<T>
public void
to(Consumer<Object>
the consumer that should accept the value if it's not been filtered
consumer
)

Implements io.r2dbc.pool.OptionMapper.Source.to.

Complete the mapping by passing any non-filtered value to the specified consumer.
public static OptionMapper.NullSource
public static OptionMapper.NullSource[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final OptionMapper.NullSource INSTANCE

Constructor Detail

NullSourceback to summary
private NullSource()

Method Detail

asback to summary
public <R> OptionMapper.Source<R> as(Function<Object, R> mappingFunction)

Implements io.r2dbc.pool.OptionMapper.Source.as.

Doc from io.r2dbc.pool.OptionMapper.Source.as.

Return an mapped version of the source changed via the given mapping function.

Parameters
<R>
the resulting type
mappingFunction:Function<Object, R>

the mapping function to apply

Returns:OptionMapper.Source<R>

a new adapted source instance

Annotations
@Override
instanceback to summary
public static <T> OptionMapper.Source<T> instance()
toback to summary
public void to(Consumer<Object> consumer)

Implements io.r2dbc.pool.OptionMapper.Source.to.

Doc from io.r2dbc.pool.OptionMapper.Source.to.

Complete the mapping by passing any non-filtered value to the specified consumer.

Parameters
consumer:Consumer<Object>

the consumer that should accept the value if it's not been filtered

Annotations
@Override
valueOfback to summary
public static OptionMapper.NullSource valueOf(String name)
valuesback to summary
public static OptionMapper.NullSource[] values()
io.r2dbc.pool back to summary

public Interface OptionMapper.Source<T>

Known Direct Implementers
io.r2dbc.pool.OptionMapper.NullSource, io.r2dbc.pool.OptionMapper.AvailableSource

Method Summary

Modifier and TypeMethod and Description
public <
the resulting type
R
>
OptionMapper.Source<R>

Returns:

a new adapted source instance
as
(Function<Object, R>
the mapping function to apply
mappingFunction
)

Return an mapped version of the source changed via the given mapping function.

public void
to(Consumer<T>
the consumer that should accept the value if it's not been filtered
consumer
)

Complete the mapping by passing any non-filtered value to the specified consumer.

Method Detail

asback to summary
public <R> OptionMapper.Source<R> as(Function<Object, R> mappingFunction)

Return an mapped version of the source changed via the given mapping function.

Parameters
<R>
the resulting type
mappingFunction:Function<Object, R>

the mapping function to apply

Returns:OptionMapper.Source<R>

a new adapted source instance

toback to summary
public void to(Consumer<T> consumer)

Complete the mapping by passing any non-filtered value to the specified consumer.

Parameters
consumer:Consumer<T>

the consumer that should accept the value if it's not been filtered