Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 58916 invoked from network); 16 Aug 2003 16:45:32 -0000 Received: from smtp-out2.blueyonder.co.uk (195.188.213.5) by daedalus.apache.org with SMTP; 16 Aug 2003 16:45:32 -0000 Received: from localhost ([80.194.24.21]) by smtp-out2.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.5600); Sat, 16 Aug 2003 17:45:34 +0100 Date: Sat, 16 Aug 2003 17:47:29 +0100 Subject: Re: Introspection and Enums Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) From: robert burrell donkin To: "Jakarta Commons Users List" Content-Transfer-Encoding: 7bit In-Reply-To: Message-Id: <52B2C180-D009-11D7-BC14-003065DC754C@blueyonder.co.uk> X-Mailer: Apple Mail (2.482) X-OriginalArrivalTime: 16 Aug 2003 16:45:34.0454 (UTC) FILETIME=[D0139160:01C36415] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N hi chris i don't think that this is possible with beanutils (at the moment). beanutils is intended to support only java beans - and that means empty constructors. beanutils is in the process of beanification and there has been talk about adding more pluggable strategies. if this happens then you may be able to choose a strategy which handles non-java-bean concepts such as enums. so (if you can) stay tuned - or add this functionality to your own custom subclass. - robert On Tuesday, July 22, 2003, at 11:16 AM, Chris Davis wrote: > Hi, > > What I want to do is to populate an object which has a number of simple > set > methods taking String, ints etc. > It also has a setStatus(JournalStatusEnum) method which takes an object > of a > specific class: in this case a JournalStatusEnum. > > The JournalStatusEnum has a private constructor and holds a singleton > instance of each of the different possible status values. These instances > are got using the getInstance(String) method. > > I'm encoding this in the source property name as "status.instance", but it > is causing a problem: > > java.lang.IllegalArgumentException: Null property value for 'status' > at > org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor > (PropertyUti > ls.java:864) > at > org.apache.commons.beanutils.PropertyUtils.isWriteable(PropertyUtils.java: > 12 > 88) > at > org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:237) > at > com.biomedcentral.noddy.integration.oracledao.OracleJournalVolumesDAO.search > ForJournalVolumes(OracleJournalVolumesDAO.java:330) > at > com.biomedcentral.noddy.integration.oracledao.OracleJournalVolumesDAO.search > (OracleJournalVolumesDAO.java:135) > at > com.biomedcentral.noddy.datatool.test.bmc.BMCSearchJournalVolumesTest.testSe > archJournalVolumesNormal(BMCSearchJournalVolumesTest.java:48) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: > 39 > ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl > .java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > (RemoteTestRu > nner.java:392) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run > (RemoteTestRunner. > java:276) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main > (RemoteTestRunner > .java:167) > > I'm not actually sure whether this is possible, as I can't find details of > introspection which takes this form. > > Any suggestions would be very useful, > > Thanks in advance for your help, > > Chris > > ________________________________________________________________________ > This email has been scanned for all viruses by the MessageLabs Email > Security System. For more information on a proactive email security > service working around the clock, around the globe, visit > http://www.messagelabs.com > ________________________________________________________________________ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org >