From xbean-user-lisa23@example.net Thu Jan 04 00:26:15 2007
Return-Path: <xbean-user-lisa23@example.net>
Delivered-To: lisa23@example.net
Received: (qmail 6414 invoked from network); 4 Jan 2007 00:26:14 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 4 Jan 2007 00:26:14 -0000
Received: (qmail 14065 invoked by uid 500); 4 Jan 2007 00:26:21 -0000
Delivered-To: lisa23@example.net
Received: (qmail 14041 invoked by uid 500); 4 Jan 2007 00:26:21 -0000
Mailing-List: contact lisa23@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:lisa23@example.net>
List-Unsubscribe: <mailto:lisa23@example.net>
List-Post: <mailto:lisa23@example.net>
List-Id: <xbean-user.geronimo.apache.org>
Reply-To: lisa23@example.net
Delivered-To: mailing list lisa23@example.net
Received: (qmail 14032 invoked by uid 99); 4 Jan 2007 00:26:21 -0000
Received: from herse.apache.org (HELO herse.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jan 2007 16:26:21 -0800
X-ASF-Spam-Status: No, hits=2.0 required=10.0
	tests=HTML_MESSAGE,SPF_PASS
X-Spam-Check-By: apache.org
Received-SPF: pass (herse.apache.org: domain of lisa23@example.net designates 83.161.120.155 as permitted sender)
Received: from [83.161.120.155] (HELO mail.revolsys.com) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jan 2007 16:26:11 -0800
Received: from [83.161.120.155] (chief.int.revolsys.com [83.161.120.155])
	by mail.revolsys.com (Postfix) with ESMTP id 5804A108E938
	for <lisa23@example.net>; Wed,  3 Jan 2007 16:25:44 -0800 (PST)
Subject: Re: Using maps as properties for a bean
From: Paul Austin <lisa23@example.net>
To: lisa23@example.net
In-Reply-To: <lisa23@example.net>
References: <lisa23@example.net>
	 <lisa23@example.net>
	 <lisa23@example.net>
	 <lisa23@example.net>
	 <lisa23@example.net>
	 <lisa23@example.net>
Content-Type: multipart/alternative; boundary="=-E9Lvynh8EE7gNqWxd+zu"
Date: Wed, 03 Jan 2007 16:25:43 -0800
Message-Id: <lisa23@example.net>
Mime-Version: 1.0
X-Mailer: Evolution 83.161.120.155 
X-Virus-Checked: Checked by ClamAV on apache.org

--=-E9Lvynh8EE7gNqWxd+zu
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Not sure if that would be practical as there are many properties that
are maps so it could get confusing to create the document.

I've submitted a Jira issue, so will see if anyone can come up with a
solution or enhancement to support this.

Paul

On Sat, 2006-12-23 at 00:45 +0100, Guillaume Nodet wrote:

> I don't think this is supported :(
> You could use
> 
> <beans:beans
>  xmlns="http://ns.com/app/1.0"
>  xmlns:beans="http://www.springframework.org/schema/beans"
>  xmlns:util="http://www.springframework.org/schema/util"
> >
>  <MyObject mapProperty="#props">
>  </MyObject>
> 
>    <util:map id="props">
>       <beans:entry key="sideBar" value="hello" />
>    </util:map>
> </beans:beans>
> 
> On 12/23/06, Paul Austin <lisa23@example.net> wrote:
> > Ok that works slightly better, with property it works assuming you want
> > the string content. In my real app the content of the map is another
> > type of object.
> >
> > Any ideas on the non-string case?
> >
> > Paul
> >
> > On Sat, 2006-12-23 at 00:07 +0100, Guillaume Nodet wrote:
> >
> > > Try something like that:
> > >
> > > <beans:beans
> > >  xmlns="http://ns.com/app/1.0"
> > >  xmlns:beans="http://www.springframework.org/schema/beans"
> > >  xmlns:util="http://www.springframework.org/schema/util"
> > > >
> > >  <MyObject>
> > >   <mapProperty>
> > >     <property key="sideBar">hello</property>
> > >   </mapProperty>
> > >  </MyObject>
> > > </beans:beans>
> > >
> > > It just occured to me that xbean has its own syntax for maps.
> > >
> > > On 12/22/06, Paul Austin <lisa23@example.net> wrote:
> > > > I just tried that and also it does not work.
> > > >
> > > > Paul
> > > >
> > > > On Fri, 2006-12-22 at 21:43 +0100, Guillaume Nodet wrote:
> > > >
> > > > > THis is just a guess, but the default namespace is not
> > > > > the spring namespace, so i'm wondering if you should write:
> > > > >
> > > > > <beans:beans
> > > > >  xmlns="http://ns.com/app/1.0"
> > > > >  xmlns:beans="http://www.springframework.org/schema/beans"
> > > > >  xmlns:util="http://www.springframework.org/schema/util"
> > > > > >
> > > > >  <MyObject>
> > > > >    <mapProperty>
> > > > >      <util:map>
> > > > >         <!-- Use the spring namespace for entry -->
> > > > >         <beans:entry key="sideBar" value="hello" />
> > > > >      </util:map>
> > > > >    </mapProperty>
> > > > >  </MyObject>
> > > > > </beans:beans>
> > > > >
> > > > > On 12/22/06, Paul Austin <lisa23@example.net> wrote:
> > > > > > I am trying to set a map property on a bean using xbean-2.6 and all I
> > > > > > seem to get back is an empty map.
> > > > > >
> > > > > > The bean config file is similar to as shown below.
> > > > > >
> > > > > >
> > > > > > <beans:beans
> > > > > >   xmlns="http://ns.com/app/1.0"
> > > > > >   xmlns:beans="http://www.springframework.org/schema/beans"
> > > > > >   xmlns:util="http://www.springframework.org/schema/util"
> > > > > > >
> > > > > >   <MyObject>
> > > > > >     <mapProperty>
> > > > > >       <util:map>
> > > > > >          <entry key="sideBar" value="hello" />
> > > > > >       </util:map>
> > > > > >     </mapProperty>
> > > > > >   </MyObject>
> > > > > > </beans:beans>
> > > > > >
> > > > > >
> > > > > > If I add a log statement to MyObject.setMapProperty it is called but the
> > > > > > value is {}. also when I then get the values later it is also the empty
> > > > > > collection (I was wondering if the map was set first and then populated
> > > > > > later).
> > > > > >
> > > > > >
> > > > > > class MyObject {
> > > > > >   public void setMapProperty(Map values) {
> > > > > >     log.debug(values);
> > > > > >     this.mapProperty = values;
> > > > > >   }
> > > > > > }
> > > > > >
> > > > > >
> > > > > > Any ideas? Have I got the syntax right?
> > > > > >
> > > > > > Paul
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> 
> 

--=-E9Lvynh8EE7gNqWxd+zu--



{'source': 'Apache Software Foundation Public Mail Archives'}