T
- the source typepublic static final class PropertyMapper.Source<T>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
<R> PropertyMapper.Source<R> |
as(java.util.function.Function<T,R> adapter)
Return an adapted version of the source changed through the given adapter
function.
|
<R extends java.lang.Number> |
asInt(java.util.function.Function<T,R> adapter)
Return an adapted version of the source with
Integer type. |
void |
to(java.util.function.Consumer<T> consumer)
Complete the mapping by passing any non-filtered value to the specified
consumer.
|
void |
toCall(java.lang.Runnable runnable)
Complete the mapping by calling the specified method when the value has not
been filtered.
|
<R> R |
toInstance(java.util.function.Function<T,R> factory)
Complete the mapping by creating a new instance from the non-filtered value.
|
PropertyMapper.Source<T> |
when(java.util.function.Predicate<T> predicate)
Return a filtered version of the source that won't map values that don't match
the given predicate.
|
PropertyMapper.Source<T> |
whenEqualTo(java.lang.Object object)
Return a filtered version of the source that will only map values equal to the
specified
object . |
PropertyMapper.Source<T> |
whenFalse()
Return a filtered version of the source that will only map values that are
false . |
PropertyMapper.Source<T> |
whenHasText()
Return a filtered version of the source that will only map values that have a
toString() containing actual text. |
<R extends T> |
whenInstanceOf(java.lang.Class<R> target)
Return a filtered version of the source that will only map values that are an
instance of the given type.
|
PropertyMapper.Source<T> |
whenNonNull()
Return a filtered version of the source that won't map non-null values or
suppliers that throw a
NullPointerException . |
PropertyMapper.Source<T> |
whenNot(java.util.function.Predicate<T> predicate)
Return a filtered version of the source that won't map values that match the
given predicate.
|
PropertyMapper.Source<T> |
whenTrue()
Return a filtered version of the source that will only map values that are
true . |
public <R extends java.lang.Number> PropertyMapper.Source<java.lang.Integer> asInt(java.util.function.Function<T,R> adapter)
Integer
type.R
- the resulting typeadapter
- an adapter to convert the current value to a number.public <R> PropertyMapper.Source<R> as(java.util.function.Function<T,R> adapter)
R
- the resulting typeadapter
- the adapter to applypublic PropertyMapper.Source<T> whenNonNull()
NullPointerException
.public PropertyMapper.Source<T> whenTrue()
true
.public PropertyMapper.Source<T> whenFalse()
false
.public PropertyMapper.Source<T> whenHasText()
toString()
containing actual text.public PropertyMapper.Source<T> whenEqualTo(java.lang.Object object)
object
.object
- the object to matchpublic <R extends T> PropertyMapper.Source<R> whenInstanceOf(java.lang.Class<R> target)
R
- the target typetarget
- the target type to matchpublic PropertyMapper.Source<T> whenNot(java.util.function.Predicate<T> predicate)
predicate
- the predicate used to filter valuespublic PropertyMapper.Source<T> when(java.util.function.Predicate<T> predicate)
predicate
- the predicate used to filter valuespublic void to(java.util.function.Consumer<T> consumer)
consumer
- the consumer that should accept the value if it's not been
filteredpublic <R> R toInstance(java.util.function.Function<T,R> factory)
R
- the resulting typefactory
- the factory used to create the instancejava.util.NoSuchElementException
- if the value has been filteredpublic void toCall(java.lang.Runnable runnable)
runnable
- the method to call if the value has not been filtered