Luca Burgazzoli created CAMEL-10390:

             Summary: ObjectHelper's after/before/between enhancements
                 Key: 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) {

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 ->

This message was sent by Atlassian JIRA

Reply via email to