The last 2 rows of the variables table shows ways that are supposed to get
properties by name, but I tried to use it and it throws an exception. The
RootObject passed to OGNL has getProperty methods, but OGNL will not match
up property(...) to getProperty() method. OGNL 4 can match property[name]
to getProperty, but that is not released yet and is square brackets instead
of parens.

You could make property(...) methods but that would only work for reading
the property, not setting the property.

As it stands now the syntax that works is:

properties -- Gets map of all properties
properties[name] -- specific property, can be used to get or set
getProperty(name) -- Get specific property
getProperty(name, type) -- Get specific property as type

I just realized that RootObject is missing any setter methods, e.g.
setProperty. The only way to set a property from within OGNL is using:

    properties['name'[ = value

But then again you have the DSL support for setting properties.
 On Sep 20, 2013 1:57 AM, "Claus Ibsen" <[email protected]> wrote:

> Can you post the link to where you found this "mistake". I cannot see
> a problem at
> http://camel.apache.org/ognl
>
> On Fri, Sep 20, 2013 at 12:57 AM, Dale King <[email protected]> wrote:
> > In the documentation for the Camel OGNL component it shows the following
> > syntax:
> >
> > property(name) Object the property by the given name property(name,
> type) the
> > property by the given name as the given type
> > This syntax does not actually work in camel and I do not see any tests
> that
> > tried to test that it worked.
> >
> > If you change those to getProperty they work. properties[name] also
> works.
> >
> > In OGNL 4, which has not been released yet, property[name] should work.
> > --
> > Dale King
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: [email protected]
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Reply via email to