T
- the source typepublic static final class PropertyMapper.Source<T> extends Object
Modifier and Type | Method and Description |
---|---|
<R> PropertyMapper.Source<R> |
as(Function<T,R> adapter)
Return an adapted version of the source changed via the given adapter function.
|
<R extends Number> |
asInt(Function<T,R> adapter)
Return an adapted version of the source with
Integer type. |
void |
to(Consumer<T> consumer)
Complete the mapping by passing any non-filtered value to the specified
consumer.
|
void |
toCall(Runnable runnable)
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.
|
PropertyMapper.Source<T> |
when(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(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(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(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 Number> PropertyMapper.Source<Integer> asInt(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(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(Object object)
object
.object
- the object to matchpublic <R extends T> PropertyMapper.Source<R> whenInstanceOf(Class<R> target)
R
- the target typetarget
- the target type to matchpublic PropertyMapper.Source<T> whenNot(Predicate<T> predicate)
predicate
- the predicate used to filter valuespublic PropertyMapper.Source<T> when(Predicate<T> predicate)
predicate
- the predicate used to filter valuespublic void to(Consumer<T> consumer)
consumer
- the consumer that should accept the value if it's not been
filteredpublic <R> R toInstance(Function<T,R> factory)
R
- the resulting typefactory
- the factory used to create the instanceNoSuchElementException
- if the value has been filteredpublic void toCall(Runnable runnable)
runnable
- the method to call if the value has not been filteredCopyright © 2019 Pivotal Software, Inc.. All rights reserved.