Is it possible to address custom JPanel in YML config that has a constructor that takes a custom argument?

13 views
Skip to first unread message

io

unread,
Apr 11, 2011, 9:12:48 AM4/11/11
to JavaBuilders
Hi all,

I try to figuere out how to setup a custom JPanel in a YML file that
takes two arguments. Eg.

class MyPanel extends JPanel
{
MyPanel ( Object a, Object b)
{
...
}
}

Is that possible?

Best regards,
Ingo

Jacek Furmankiewicz

unread,
Apr 11, 2011, 9:36:30 AM4/11/11
to javabu...@googlegroups.com
No. We always assume a zero-args constructor (otherwise we have to code custom code).

But if you have setters/getters for those properties it should work just fine. We will instantiate the class and run the setters on it.


--
You received this message because you are subscribed to the Google Groups "JavaBuilders" group.
To post to this group, send email to javabu...@googlegroups.com.
To unsubscribe from this group, send email to javabuilders...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javabuilders?hl=en.


io

unread,
Apr 11, 2011, 10:31:32 AM4/11/11
to JavaBuilders
Hi Jacek,

thanks for the fast reply! Though I've to re-think my strategy now ;-)

Best regards,
Ingo

Jacek Furmankiewicz

unread,
Apr 11, 2011, 10:34:30 AM4/11/11
to javabu...@googlegroups.com
We could probably do something a bit more flexible (like Spring constructor args injection)
and if we detect lack of zero-args constructor, try to match the appropriate YAML arguments
into it, but that would have some complexities attached to it.

Maybe a good RFE though, if you want to log it.

Jacek
Reply all
Reply to author
Forward
0 new messages