Class PropertyMapper.Source<T>

    • Method Detail

      • asInt

        public <R extends NumberPropertyMapper.Source<IntegerasInt​(Function<T,​R> adapter)
        Return an adapted version of the source with Integer type.
        Type Parameters:
        R - the resulting type
        Parameters:
        adapter - an adapter to convert the current value to a number.
        Returns:
        a new adapted source instance
      • as

        public <R> PropertyMapper.Source<R> as​(Function<T,​R> adapter)
        Return an adapted version of the source changed via the given adapter function.
        Type Parameters:
        R - the resulting type
        Parameters:
        adapter - the adapter to apply
        Returns:
        a new adapted source instance
      • whenTrue

        public PropertyMapper.Source<TwhenTrue()
        Return a filtered version of the source that will only map values that are true.
        Returns:
        a new filtered source instance
      • whenFalse

        public PropertyMapper.Source<TwhenFalse()
        Return a filtered version of the source that will only map values that are false.
        Returns:
        a new filtered source instance
      • whenHasText

        public PropertyMapper.Source<TwhenHasText()
        Return a filtered version of the source that will only map values that have a toString() containing actual text.
        Returns:
        a new filtered source instance
      • whenEqualTo

        public PropertyMapper.Source<TwhenEqualTo​(Object object)
        Return a filtered version of the source that will only map values equal to the specified object.
        Parameters:
        object - the object to match
        Returns:
        a new filtered source instance
      • whenInstanceOf

        public <R extends TPropertyMapper.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.
        Type Parameters:
        R - the target type
        Parameters:
        target - the target type to match
        Returns:
        a new filtered source instance
      • whenNot

        public PropertyMapper.Source<TwhenNot​(Predicate<T> predicate)
        Return a filtered version of the source that won't map values that match the given predicate.
        Parameters:
        predicate - the predicate used to filter values
        Returns:
        a new filtered source instance
      • when

        public PropertyMapper.Source<Twhen​(Predicate<T> predicate)
        Return a filtered version of the source that won't map values that don't match the given predicate.
        Parameters:
        predicate - the predicate used to filter values
        Returns:
        a new filtered source instance
      • to

        public void to​(Consumer<T> consumer)
        Complete the mapping by passing any non-filtered value to the specified consumer.
        Parameters:
        consumer - the consumer that should accept the value if it's not been filtered
      • toInstance

        public <R> R toInstance​(Function<T,​R> factory)
        Complete the mapping by creating a new instance from the non-filtered value.
        Type Parameters:
        R - the resulting type
        Parameters:
        factory - the factory used to create the instance
        Returns:
        the instance
        Throws:
        NoSuchElementException - if the value has been filtered
      • toCall

        public void toCall​(Runnable runnable)
        Complete the mapping by calling the specified method when the value has not been filtered.
        Parameters:
        runnable - the method to call if the value has not been filtered