类 PropertyMapper.Source<T>
java.lang.Object
org.springframework.boot.context.properties.PropertyMapper.Source<T>
- 类型参数:
T
- the source type
- 封闭类:
PropertyMapper
A source that is in the process of being mapped.
-
方法概要
修饰符和类型方法说明<R> PropertyMapper.Source
<R> Return an adapted version of the source changed through the given adapter function.<R extends Number>
PropertyMapper.Source<Integer> Return an adapted version of the source withInteger
type.void
Complete the mapping by passing any non-filtered value to the specified consumer.<R> R
to
(R instance, BiFunction<R, T, R> mapper) Complete the mapping for any non-filtered value by applying the given function to an existing instance and returning a new one.void
Complete the mapping by calling the specified method when the value has not been filtered.<R> R
toInstance
(Function<T, R> factory) Complete the mapping by creating a new instance from the non-filtered value.Return a filtered version of the source that won't map values that don't match the given predicate.whenEqualTo
(Object object) Return a filtered version of the source that will only map values equal to the specifiedobject
.Return a filtered version of the source that will only map values that arefalse
.Return a filtered version of the source that will only map values that have atoString()
containing actual text.<R extends T>
PropertyMapper.Source<R> whenInstanceOf
(Class<R> target) Return a filtered version of the source that will only map values that are an instance of the given type.Return a filtered version of the source that won't map non-null values or suppliers that throw aNullPointerException
.Return a filtered version of the source that won't map values that match the given predicate.whenTrue()
Return a filtered version of the source that will only map values that aretrue
.
-
方法详细资料
-
asInt
Return an adapted version of the source withInteger
type.- 类型参数:
R
- the resulting type- 参数:
adapter
- an adapter to convert the current value to a number.- 返回:
- a new adapted source instance
-
as
Return an adapted version of the source changed through the given adapter function.- 类型参数:
R
- the resulting type- 参数:
adapter
- the adapter to apply- 返回:
- a new adapted source instance
-
whenNonNull
Return a filtered version of the source that won't map non-null values or suppliers that throw aNullPointerException
.- 返回:
- a new filtered source instance
-
whenTrue
Return a filtered version of the source that will only map values that aretrue
.- 返回:
- a new filtered source instance
-
whenFalse
Return a filtered version of the source that will only map values that arefalse
.- 返回:
- a new filtered source instance
-
whenHasText
Return a filtered version of the source that will only map values that have atoString()
containing actual text.- 返回:
- a new filtered source instance
-
whenEqualTo
Return a filtered version of the source that will only map values equal to the specifiedobject
.- 参数:
object
- the object to match- 返回:
- a new filtered source instance
-
whenInstanceOf
Return a filtered version of the source that will only map values that are an instance of the given type.- 类型参数:
R
- the target type- 参数:
target
- the target type to match- 返回:
- a new filtered source instance
-
whenNot
Return a filtered version of the source that won't map values that match the given predicate.- 参数:
predicate
- the predicate used to filter values- 返回:
- a new filtered source instance
-
when
Return a filtered version of the source that won't map values that don't match the given predicate.- 参数:
predicate
- the predicate used to filter values- 返回:
- a new filtered source instance
-
to
Complete the mapping by passing any non-filtered value to the specified consumer. The method is designed to be used with mutable objects.- 参数:
consumer
- the consumer that should accept the value if it's not been filtered
-
to
Complete the mapping for any non-filtered value by applying the given function to an existing instance and returning a new one. For filtered values, theinstance
parameter is returned unchanged. The method is designed to be used with immutable objects.- 类型参数:
R
- the result type- 参数:
instance
- the current instancemapper
- the mapping function- 返回:
- a new mapped instance or the original instance
- 从以下版本开始:
- 3.0.0
-
toInstance
Complete the mapping by creating a new instance from the non-filtered value.- 类型参数:
R
- the resulting type- 参数:
factory
- the factory used to create the instance- 返回:
- the instance
- 抛出:
NoSuchElementException
- if the value has been filtered
-
toCall
Complete the mapping by calling the specified method when the value has not been filtered.- 参数:
runnable
- the method to call if the value has not been filtered
-