You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-user@geronimo.apache.org by Alex Karasulu <ak...@apache.org> on 2008/08/27 05:39:32 UTC
Setting a property with List extends SocketAddress> objects
Hi all,
I've been trying to setup a module for MINA to enable easy use of
XBean-Spring with MINA classes. I've been trying to figure out how to
compose the XML for a List property of a class. The List contains elements
extending the java.net.SocketAddress class which I cannot alter the javadocs
of. Here's a mock up of the situation:
class Foo
{
....
public void setLocalAddress( SocketAddress address )
....
public void setLocalAddresses( List<? extends SocketAddress> addresses)
....
}
The first property taking a single address is configured easily using the
following XML frag:
<foo localAddress="192.168.0.1:10001" />
I'm using a InetSocketAddressEditor (PropertyEditor) which is registered
with Spring for SocketAddress.class. It works great for the first
property. However I have not been able to figure out much less find a way
to make the second property with the list of addresses work. I've tried a
number of combinations but none have worked. Here's a list of them:
<foo localAddresses="192.168.0.1:10001 192.168.0.1:10002" />
---
<foo localAddresses="192.168.0.1:10001, 192.168.0.1:10002" />
---
<foo localAddresses="192.168.0.1:10001,192.168.0.1:10002" />
---
<foo>
<localAddresses>
<s:value>192.168.0.1:10001</s:value>
<s:value>192.168.0.1:10002</s:value>
</localAddresses>
</foo>
I think half the problem is in the fact that I cannot annotate the javadocs
of the SocketAddress in the JDK. I was wondering if anyone has an idea on
how to get around this limitation.
Thanks,
Alex
Re: Setting a property with List extends SocketAddress> objects
Posted by Dain Sundstrom <da...@iq80.com>.
You can use a factory method to achieve this. I checked in an example
for you:
http://svn.apache.org/viewvc?view=rev&revision=689356
We should be able to support a list of simple types converted from a
string value using a PropertyEditor. Anyone know if/how we can do that?
-dain
On Aug 26, 2008, at 8:39 PM, Alex Karasulu wrote:
> Hi all,
>
> I've been trying to setup a module for MINA to enable easy use of
> XBean-Spring with MINA classes. I've been trying to figure out how to
> compose the XML for a List property of a class. The List contains
> elements
> extending the java.net.SocketAddress class which I cannot alter the
> javadocs
> of. Here's a mock up of the situation:
>
> class Foo
> {
> ....
>
> public void setLocalAddress( SocketAddress address )
> ....
>
> public void setLocalAddresses( List<? extends SocketAddress>
> addresses)
>
> ....
> }
>
> The first property taking a single address is configured easily
> using the
> following XML frag:
>
> <foo localAddress="192.168.0.1:10001" />
>
> I'm using a InetSocketAddressEditor (PropertyEditor) which is
> registered
> with Spring for SocketAddress.class. It works great for the first
> property. However I have not been able to figure out much less find
> a way
> to make the second property with the list of addresses work. I've
> tried a
> number of combinations but none have worked. Here's a list of them:
>
> <foo localAddresses="192.168.0.1:10001 192.168.0.1:10002" />
>
> ---
>
> <foo localAddresses="192.168.0.1:10001, 192.168.0.1:10002" />
>
> ---
>
> <foo localAddresses="192.168.0.1:10001,192.168.0.1:10002" />
>
> ---
>
> <foo>
> <localAddresses>
> <s:value>192.168.0.1:10001</s:value>
> <s:value>192.168.0.1:10002</s:value>
> </localAddresses>
> </foo>
>
> I think half the problem is in the fact that I cannot annotate the
> javadocs
> of the SocketAddress in the JDK. I was wondering if anyone has an
> idea on
> how to get around this limitation.
>
> Thanks,
> Alex
Re: Setting a property with List extends SocketAddress> objects
Posted by Dain Sundstrom <da...@iq80.com>.
You can use a factory method to achieve this. I checked in an example
for you:
http://svn.apache.org/viewvc?view=rev&revision=689356
We should be able to support a list of simple types converted from a
string value using a PropertyEditor. Anyone know if/how we can do that?
-dain
On Aug 26, 2008, at 8:39 PM, Alex Karasulu wrote:
> Hi all,
>
> I've been trying to setup a module for MINA to enable easy use of
> XBean-Spring with MINA classes. I've been trying to figure out how to
> compose the XML for a List property of a class. The List contains
> elements
> extending the java.net.SocketAddress class which I cannot alter the
> javadocs
> of. Here's a mock up of the situation:
>
> class Foo
> {
> ....
>
> public void setLocalAddress( SocketAddress address )
> ....
>
> public void setLocalAddresses( List<? extends SocketAddress>
> addresses)
>
> ....
> }
>
> The first property taking a single address is configured easily
> using the
> following XML frag:
>
> <foo localAddress="192.168.0.1:10001" />
>
> I'm using a InetSocketAddressEditor (PropertyEditor) which is
> registered
> with Spring for SocketAddress.class. It works great for the first
> property. However I have not been able to figure out much less find
> a way
> to make the second property with the list of addresses work. I've
> tried a
> number of combinations but none have worked. Here's a list of them:
>
> <foo localAddresses="192.168.0.1:10001 192.168.0.1:10002" />
>
> ---
>
> <foo localAddresses="192.168.0.1:10001, 192.168.0.1:10002" />
>
> ---
>
> <foo localAddresses="192.168.0.1:10001,192.168.0.1:10002" />
>
> ---
>
> <foo>
> <localAddresses>
> <s:value>192.168.0.1:10001</s:value>
> <s:value>192.168.0.1:10002</s:value>
> </localAddresses>
> </foo>
>
> I think half the problem is in the fact that I cannot annotate the
> javadocs
> of the SocketAddress in the JDK. I was wondering if anyone has an
> idea on
> how to get around this limitation.
>
> Thanks,
> Alex