You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (JIRA)" <ji...@apache.org> on 2016/10/20 10:18:58 UTC

[jira] [Resolved] (CAMEL-10390) ObjectHelper's after/before/between enhancements

     [ https://issues.apache.org/jira/browse/CAMEL-10390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luca Burgazzoli resolved CAMEL-10390.
-------------------------------------
    Resolution: Fixed

> ObjectHelper's after/before/between enhancements
> ------------------------------------------------
>
>                 Key: CAMEL-10390
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10390
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Luca Burgazzoli
>            Assignee: Luca Burgazzoli
>            Priority: Minor
>             Fix For: 2.18.1, 2.19.0
>
>
> I've sometime had the need to find a string after a separator, lookup
> an object based on the result value and then use it to process
> something, like:
>     String after = ObjectHelper.after(key, ":");
>     if (after != null) {
>         MyStuff s = cache.get(after)
>         if (s != null) {
>             s.doSomething(exchange)
>         }
>     }
> So I wonder whether it makes sense to add a 'fluent' variant to these
> functions to impement such pattern, like:
>     <T> Optional<T> after(String value, String delimiter,
> Function<String, T> function)
> The we could do something like:
>     ObjectHelper.after(key, ":", cache::get).ifPresent(s ->
> s.doSomething(exchange));



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)