You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Chris Davis <ch...@biomedcentral.com> on 2003/07/23 18:39:21 UTC

RE: [BeanUtils] Introspection and Enums

Sorry to everyone again, but does anyone know whether this is possible?

Thanks,
Chris Davis

-----Original Message-----
From: Chris Davis [mailto:chrisd@biomedcentral.com]
Sent: 22 July 2003 11:16
To: 'commons-user@jakarta.apache.org'
Subject: Introspection and Enums


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

________________________________________________________________________
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
________________________________________________________________________

Re: [BeanUtils] Introspection and Enums

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi chris

(i'm not totally sure i understand your problem completely so you might 
need to set me straight if i've got it wrong.)

one possible reason for this is that your bean is not compliant with the 
java beans specification (in particular, the getter and setter must have 
matching types).

if your bean is complaint then i suspect the problem is with your use of 
the expression language. what would help me is posting the beanutils trace 
logging and a fuller example of what you're doing.

- robert

On Wednesday, July 23, 2003, at 05:39 PM, Chris Davis wrote:

> Sorry to everyone again, but does anyone know whether this is possible?
>
> Thanks,
> Chris Davis
>
> -----Original Message-----
> From: Chris Davis [mailto:chrisd@biomedcentral.com]
> Sent: 22 July 2003 11:16
> To: 'commons-user@jakarta.apache.org'
> Subject: Introspection and Enums
>
>
> 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
>
> ________________________________________________________________________
> 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
>