commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: Introspection and Enums
Date Sat, 16 Aug 2003 16:47:29 GMT
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
>


Mime
View raw message