send this to commons, it is too specific for BeanUtils, possible some bug.

----- Original Message -----
From: "Raible, Matt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 8:00 PM
Subject: RE: [Hibernate] List -> ArrayList


> This works great until I add indexed properties to my form, so that
> properties can be accessed, retrieved with an index.  I don't get why,
esp.
> since the methods have different signatures.
>
> So no I have getPropertyList() and setPropertyList(ArrayList) on my form.
I
> also have getPropertyList(int index) and setPropertyList(int index,
> ArrayList).
>
> The the convert method below dies and doesn't work:
>
> BeanUtils.copyProperties(cmcfForm, c);
>
> returns null for my Lists on my object??
>
> Any ideas?
>
> -----Original Message-----
> From: Juozas Baliuka [mailto:[EMAIL PROTECTED]
> Sent: Sunday, January 12, 2003 1:49 AM
> To: Raible, Matt; [EMAIL PROTECTED]
> Subject: Re: [Hibernate] List -> ArrayList
>
>
>
> try this :
>
>  public Object convert(Class type, Object value) {
>
>      if (log.isDebugEnabled()) {
>          log.debug("entering 'convert' method");
>      }
>
>      // for a null value, return null
>      if (value == null) {
>          return null;
>      }else if ( value.getClass().isAssignableFrom(type) ){
>           return value;
>       }else if (  ArrayList.class.isAssignableFrom(type)   && ( value
> instanceof Collection  ) ){
>          return new ArrayList((Collection)value); // List, Set,
> ollection  -> ArrayList
>     } else if (  type.isAssignableFrom( Collection.class ) &&  ( value
> instanceof Collection  ) ) {
>        try{
>         //most of collections implement this constructor
>          Constructor constructor = type.getConstructor( new Class[]{
> Collection.class } );
>          return constructor.newInstance( new Object[]{ value } );
>       }catch(Exception e){
>          //abstract ?
>          log.debug(e);
>       }
>     }
>
>      throw new ConversionException("Could not convert "+
> value.getClass().getName() + " to " + type.getName() + "!");
>
>  }
>
>
>
>
> > I'm attempting to do this with ConvertUtils and
BeanUtils.copyProperties:
> >
> > I have a bag defined in my mapping file and a List defined in my User.
I
> > register the following Customer converter:
> >
> >
> > -----Original Message-----
> > From: Viktor Szathmary [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, January 11, 2003 3:36 PM
> > To: Raible, Matt; [EMAIL PROTECTED]
> > Subject: Re: [Hibernate] List -> ArrayList
> >
> >
> > hi,
> >
> > On Sat, 11 Jan 2003 14:34:36 -0700, "Raible, Matt"
> > <[EMAIL PROTECTED]> said:
> > > I have a List in my User object that I want to convert to an ArrayList
> on
> > > my
> > > UserForm using BeanUtils.copyProperties.  I can register a customer
> > > converter, but I need to translate cirrus.hibernate.collections.Bag
into
> > > an
> > > ArrayList.  I can't seem to find an Javadocs on this class - any ideas
> or
> > > suggestions?
> > >
> >
> > cirrus.hibernate.collections.Bag implements java.util.List, so you
should
> > be able to copy it into an ArrayList using new ArrayList(bag)...
> >
> > regards,
> >     viktor
> > --
> >
> >   [EMAIL PROTECTED]
> >
> > --
> > http://fastmail.fm - Sent 0.000002 seconds ago
> >
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by:
> > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> > http://www.vasoftware.com
> > _______________________________________________
> > hibernate-devel mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: Thawte.com
> Understand how to protect your customers personal information by
implementing
> SSL on your Apache Web Server. Click here to get our FREE Thawte Apache
> Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel



-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to