You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com> on 2014/01/07 12:08:51 UTC

Non standard Blueprint properties

Dear Karaf experts,

I asked the following question to the Aries team, but maybe there is a solution outside Aries. As far as I know Blueprint properties injection work as long as the implementation method name is in the "setXXX" format, where "XXX" is the property name.

Unfortunately a lot of classes, including brand new JavaFX ones does not follow this convention. Is there a way to handle non-standard method names with the properties?

PS: Happy new year!

Best regards,
Jean-Philippe


RE: Non standard Blueprint properties

Posted by Ryan Moquin <fr...@gmail.com>.
Ok, I'll rephrase my theory with a simple example/explanation.

Let's say you have a getter and setter like:

getABIGInteger and setABIGInteger

But the property they set/get is:

ABigInt

Then what sometimes works is to use a property name based on the getter
setter:

aBIGInteger  (Which I believe it would be).

This may work because at runtime DI frameworks will ask for the name of a
setter/getter matching the property and therefore will get the one that
exists by deriving the property name yourself that matches.  Basically, the
property name is only used to derive the setter/getter names.

I may try this for the heck of it latet and see if it works with Aries.

Ryan
On Jan 7, 2014 12:56 PM, "CLEMENT Jean-Philippe" <
jean-philippe.clement@fr.thalesgroup.com> wrote:

> Hi Ryan,
>
>
>
> In concrete terms, what am I supposed to do ?
>
>
>
> JP
>
>
>
> [@@ THALES GROUP INTERNAL @@]
>
>
>
> *De :* Ryan Moquin [mailto:fragility2.0@gmail.com]
> *Envoyé :* mardi 7 janvier 2014 16:49
> *À :* user@karaf.apache.org
> *Objet :* Re: Non standard Blueprint properties
>
>
>
> I THINK this might work, at least it does with certain DI frameworks by
> nature of how they need to work.  When a property is looked up, it isn't
> visible because it's private.  As a result, I don't think the property is
> actually looked up, I think the setter for whatever "setterified or
> getterfied" name of the propery specified in the config is actually looked
> up.  So basically, you can reference a non existing property, as long as it
> translates into a setter or getter that exists, irregardless of whether the
> property exists.
>
> Also, sometimes you can annotate a setter or getter and change the name of
> thw property associated with it.  If the Aries guys didn't respond with
> that, maybe it's not an option.  I'd give my first suggestion a try.. it's
> not pretty, but it may work.  The setter and getter lookup is based on a
> standard conversion of the property name anyhow.
>
> Hope that helps and works.
>
> Ryan
>
> On Jan 7, 2014 6:10 AM, "CLEMENT Jean-Philippe" <
> jean-philippe.clement@fr.thalesgroup.com> wrote:
>
> Dear Karaf experts,
>
> I asked the following question to the Aries team, but maybe there is a
> solution outside Aries. As far as I know Blueprint properties injection
> work as long as the implementation method name is in the "setXXX" format,
> where "XXX" is the property name.
>
> Unfortunately a lot of classes, including brand new JavaFX ones does not
> follow this convention. Is there a way to handle non-standard method names
> with the properties?
>
> PS: Happy new year!
>
> Best regards,
> Jean-Philippe
>

RE: Non standard Blueprint properties

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Hi Ryan,

In concrete terms, what am I supposed to do ?

JP

[@@ THALES GROUP INTERNAL @@]

De : Ryan Moquin [mailto:fragility2.0@gmail.com]
Envoyé : mardi 7 janvier 2014 16:49
À : user@karaf.apache.org
Objet : Re: Non standard Blueprint properties


I THINK this might work, at least it does with certain DI frameworks by nature of how they need to work.  When a property is looked up, it isn't visible because it's private.  As a result, I don't think the property is actually looked up, I think the setter for whatever "setterified or getterfied" name of the propery specified in the config is actually looked up.  So basically, you can reference a non existing property, as long as it translates into a setter or getter that exists, irregardless of whether the property exists.

Also, sometimes you can annotate a setter or getter and change the name of thw property associated with it.  If the Aries guys didn't respond with that, maybe it's not an option.  I'd give my first suggestion a try.. it's not pretty, but it may work.  The setter and getter lookup is based on a standard conversion of the property name anyhow.

Hope that helps and works.

Ryan
On Jan 7, 2014 6:10 AM, "CLEMENT Jean-Philippe" <je...@fr.thalesgroup.com>> wrote:
Dear Karaf experts,

I asked the following question to the Aries team, but maybe there is a solution outside Aries. As far as I know Blueprint properties injection work as long as the implementation method name is in the "setXXX" format, where "XXX" is the property name.

Unfortunately a lot of classes, including brand new JavaFX ones does not follow this convention. Is there a way to handle non-standard method names with the properties?

PS: Happy new year!

Best regards,
Jean-Philippe

Re: Non standard Blueprint properties

Posted by Ryan Moquin <fr...@gmail.com>.
I THINK this might work, at least it does with certain DI frameworks by
nature of how they need to work.  When a property is looked up, it isn't
visible because it's private.  As a result, I don't think the property is
actually looked up, I think the setter for whatever "setterified or
getterfied" name of the propery specified in the config is actually looked
up.  So basically, you can reference a non existing property, as long as it
translates into a setter or getter that exists, irregardless of whether the
property exists.

Also, sometimes you can annotate a setter or getter and change the name of
thw property associated with it.  If the Aries guys didn't respond with
that, maybe it's not an option.  I'd give my first suggestion a try.. it's
not pretty, but it may work.  The setter and getter lookup is based on a
standard conversion of the property name anyhow.

Hope that helps and works.

Ryan
On Jan 7, 2014 6:10 AM, "CLEMENT Jean-Philippe" <
jean-philippe.clement@fr.thalesgroup.com> wrote:

> Dear Karaf experts,
>
> I asked the following question to the Aries team, but maybe there is a
> solution outside Aries. As far as I know Blueprint properties injection
> work as long as the implementation method name is in the "setXXX" format,
> where "XXX" is the property name.
>
> Unfortunately a lot of classes, including brand new JavaFX ones does not
> follow this convention. Is there a way to handle non-standard method names
> with the properties?
>
> PS: Happy new year!
>
> Best regards,
> Jean-Philippe
>
>