users@jaxb.java.net

Re: Cast JAXB2 generated object to JAXBElement?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 25 Aug 2010 19:51:29 +0200

A JAXBElement<? extends RpcOperationType> can contain (as its "value" field)
anything that is or extends RpcOperationType. GetUserStat(u)s doesn't fit.

So: the answer is "no".

Prabably the XML schema could be tweaked to have a more general base
type (Object) as JAXBElement's generic parameter.

-W

On 25 August 2010 19:31, wuntee <mathew_rowley_at_cable.comcast.com> wrote:
>
> I have 2 sets of XSD's, one that generates RPC based calls, and another that
> defines the product specific methods.  The RpcType object (generated by
> JAXB2) has a 'setRpcOperation' method defined by:
>
>    RpcType.setRpcOperation(JAXBElement<? extends RpcOperationType>)
>
> That 'RpcOperation' object should be the 'specific product method' described
> above.  One example is (also generated by JAXB2):
>
>
>    @XmlAccessorType(XmlAccessType.FIELD)
>    @XmlType(name = "get-user-stats", propOrder = {
>        "reset"
>    })
>    public class GetUserStats {
>
>        protected Boolean reset;
>
>        /**
>         * Gets the value of the reset property.
>         *
>         * @return
>         *     possible object is
>         *     {_at_link Boolean }
>         *
>         */
>        public Boolean isReset() {
>            return reset;
>        }
>
>        /**
>         * Sets the value of the reset property.
>         *
>         * @param value
>         *     allowed object is
>         *     {_at_link Boolean }
>         *
>         */
>        public void setReset(Boolean value) {
>            this.reset = value;
>        }
>
>    }
>
>
> Now, is it possible to create an instance of 'GetUserStatus' and add it to
> the RpcType object via setRpcOperation?
> --
> View this message in context: http://old.nabble.com/Cast-JAXB2-generated-object-to-JAXBElement--tp29534757p29534757.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>