[jboss-dev-forums] [Design of JBossXB] - Re: Using generics info in CollectionPropertyHandler

alesj do-not-reply at jboss.com
Thu Nov 27 10:41:02 EST 2008


I'm having problems creating Map test case,
where it would fail when key or value are not instance of.

I have this 'metadata' class:

  | @XmlRootElement
  | @JBossXmlSchema(namespace="ns", elementFormDefault=XmlNsForm.QUALIFIED)
  | public class RootWrongKey
  | {
  |    private Map<KeyIface, ValueIface> tester;
  | 
  |    public Map<KeyIface, ValueIface> getTester()
  |    {
  |       return tester;
  |    }
  | 
  |    @JBossXmlMapKeyElement(name = "key")
  |    @JBossXmlMapValueElement(name = "value")
  |    public void setTester(Map<KeyIface, ValueIface> tester)
  |    {
  |       this.tester = tester;
  |    }
  | }
  | 
where KeyIface and ValueIface are empty interfaces.

I'm trying to find where I can assign actual (but wrong) type, but w/o success.
I'm then getting this exception:

  | java.lang.IllegalArgumentException: No such property  for bean org.jboss.test.xb.builder.object.type.map.support.KeyIface available []
  | 	at org.jboss.beans.info.plugins.AbstractBeanInfo.getProperty(AbstractBeanInfo.java:147)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1127)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:731)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:719)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:475)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:434)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindMapProperty(JBossXBNoSchemaBuilder.java:2182)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1778)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1128)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:731)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:719)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:475)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:434)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createElementBinding(JBossXBNoSchemaBuilder.java:313)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:293)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:273)
  | 	at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:197)
  | 	at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:118)
  | 	at org.jboss.test.xb.builder.AbstractBuilderTest.unmarshalObject(AbstractBuilderTest.java:125)
  | 	at org.jboss.test.xb.builder.AbstractBuilderTest.unmarshalObject(AbstractBuilderTest.java:172)
  | 	at org.jboss.test.xb.builder.object.type.map.test.KeyValueTypeUnitTestCase.testFailure(KeyValueTypeUnitTestCase.java:68)
  | 	at org.jboss.test.xb.builder.object.type.map.test.KeyValueTypeUnitTestCase.testWrongKey(KeyValueTypeUnitTestCase.java:50)
  | 

Any hint on how to produce such failing test? ;-)

ps: I managed to do it for Collection. :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4192814#4192814

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4192814



More information about the jboss-dev-forums mailing list