You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Shultz, Dmitry" <Dm...@kaltire.com> on 2021/12/08 21:17:02 UTC

Invoke method in Predicate

Hi All,

I'm migrating some service from 2.25 to 3.13 using the migration guide - so far so good, but there is one thing I can't figure out (in a reasonable amount of time).
The code that compiles in 2.25 looks like this:

Predicate hasNoEmail = and(body().isInstanceOf(Some.class), bodyAs(Some.class).method("getCustomer")
                .convertTo(CustomerInfo.class).method("getEmail").isNull());

With 3.13 it fails because .method() is not available anymore, so there should be some other way? What is it?


Dmitry


Re: Invoke method in Predicate

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I am adding method back as I found a way to do this in a way that is
not causing tight dependency to camel-bean

https://issues.apache.org/jira/browse/CAMEL-17467


On Mon, Jan 10, 2022 at 8:15 PM Claus Ibsen <cl...@gmail.com> wrote:
>
> Hi
>
> You can use simple instead of method ala:
>
> simple("${bodyAs(Some.class).getCustomer()}")
>
> On Wed, Dec 8, 2021 at 10:17 PM Shultz, Dmitry
> <Dm...@kaltire.com> wrote:
> >
> > Hi All,
> >
> > I'm migrating some service from 2.25 to 3.13 using the migration guide - so far so good, but there is one thing I can't figure out (in a reasonable amount of time).
> > The code that compiles in 2.25 looks like this:
> >
> > Predicate hasNoEmail = and(body().isInstanceOf(Some.class), bodyAs(Some.class).method("getCustomer")
> >                 .convertTo(CustomerInfo.class).method("getEmail").isNull());
> >
> > With 3.13 it fails because .method() is not available anymore, so there should be some other way? What is it?
> >
> >
> > Dmitry
> >
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Invoke method in Predicate

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can use simple instead of method ala:

simple("${bodyAs(Some.class).getCustomer()}")

On Wed, Dec 8, 2021 at 10:17 PM Shultz, Dmitry
<Dm...@kaltire.com> wrote:
>
> Hi All,
>
> I'm migrating some service from 2.25 to 3.13 using the migration guide - so far so good, but there is one thing I can't figure out (in a reasonable amount of time).
> The code that compiles in 2.25 looks like this:
>
> Predicate hasNoEmail = and(body().isInstanceOf(Some.class), bodyAs(Some.class).method("getCustomer")
>                 .convertTo(CustomerInfo.class).method("getEmail").isNull());
>
> With 3.13 it fails because .method() is not available anymore, so there should be some other way? What is it?
>
>
> Dmitry
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2