dev@jax-rpc.java.net

Re: Is default constructor a must for return types?

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Thu, 27 Oct 2005 15:55:49 -0700

Prakasha Aradhya wrote:
> Is it necessary to have the return type to always have a default
> constructor? In this case I dont have control on
> javax.management.MBeanInfo class as it is part of JDK? What would be
> the workaround in this situation?

Yes. Unfortunately that's a JAXB requirement (but for good reasons.)

If the only issue is the lack of the default constructor, then there are
ways to solve the problem, but if your goal is to use MBeanInfo as a
return type from your JAX-WS method invocation, it's somewhat difficult,
since the MBeanInfo class doesn't have any annotation in it for JAXB at all.

It seems to me that you have to write an XmlAdapter for each of
MBeanInfo, MBeanAttributeInfo, MBeanFeatureInfo,MBeanOperationInfo, and
MBeanParameterInfo to adapt them to a Java bean.

Search XmlJavaTypeAdapter on Google for more details.

I'm sorry that such a simple thing is this hard, but I'm afraid that's
the only way right now. Maybe in the Mustang timeframe we can put JAXB
annotations on those classes?


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com