users@jaxb.java.net

Re: new bee jaxb

From: fachhoch <fachhoch_at_gmail.com>
Date: Sat, 6 Mar 2010 04:59:08 -0800 (PST)

I added the no arg constructor, but I think the problem is with proxy
creation , actually I return this dto from my web service so something
is changing this class after compilation , the classfile I l looked using
decompiler is different it has

here is the generated class file


import java.io.Serializable;
import net.sf.cglib.transform.impl.InterceptFieldCallback;
import net.sf.cglib.transform.impl.InterceptFieldEnabled;

public class GrantsDTO
    implements Serializable, InterceptFieldEnabled
{

    private transient InterceptFieldCallback $CGLIB_READ_WRITE_CALLBACK;
    private String grantNumber;
    private String granteeName;

    public InterceptFieldCallback getInterceptFieldCallback()
    {
        return $CGLIB_READ_WRITE_CALLBACK;
    }

    public void setInterceptFieldCallback(InterceptFieldCallback
interceptfieldcallback)
    {
        $CGLIB_READ_WRITE_CALLBACK = interceptfieldcallback;
    }

    public String $cglib_read_grantNumber()
    {
        grantNumber;
        if(getInterceptFieldCallback() != null) goto _L2; else goto _L1
_L1:
        return;
_L2:
        String s;
        s;
        return (String)getInterceptFieldCallback().readObject(this,
"grantNumber", s);
    }

    public void $cglib_write_grantNumber(String s)
    {
        grantNumber = getInterceptFieldCallback() == null ? s :
(String)getInterceptFieldCallback().writeObject(this, "grantNumber",
grantNumber, s);
    }

    public String $cglib_read_granteeName()
    {
        granteeName;
        if(getInterceptFieldCallback() != null) goto _L2; else goto _L1
_L1:
        return;
_L2:
        String s;
        s;
        return (String)getInterceptFieldCallback().readObject(this,
"granteeName", s);
    }

    public void $cglib_write_granteeName(String s)
    {
        granteeName = getInterceptFieldCallback() == null ? s :
(String)getInterceptFieldCallback().writeObject(this, "granteeName",
granteeName, s);
    }

    public String getGrantNumber()
    {
        return $cglib_read_grantNumber();
    }

    public GrantsDTO()
    {
    }

    public GrantsDTO(String grantNumber, String granteeName)
    {
        $cglib_write_granteeName(granteeName);
        $cglib_write_grantNumber(grantNumber);
    }

    public void setGrantNumber(String grantNumber)
    {
        $cglib_write_grantNumber(grantNumber);
    }

    public String getGranteeName()
    {
        return $cglib_read_granteeName();
    }

    public void setGranteeName(String granteeName)
    {
        $cglib_write_granteeName(granteeName);
    }
}



how to tell jaxb to ignore the fields added by webservice and not by me ?

Wolfgang Laun-2 wrote:
>
> The answer is in the stack dump: GrantsDTO requires to have a
> no argument constructor.
> -W
>
> On Sat, Mar 6, 2010 at 4:09 AM, fachhoch <fachhoch_at_gmail.com> wrote:
>
>>
>> I am trying to run this simple class to marshall
>>
>> here is the code
>>
>>
>> public class WSClient {
>>
>> public static void main(String[] args) throws Exception {
>>
>> JAXBContext
>> jaxbContext=JAXBContext.newInstance(GrantsDTO.class);
>> Marshaller marshaller= jaxbContext.createMarshaller();
>> GrantsDTO grantsDTO= new GrantsDTO();
>> grantsDTO.setGranteeName("grantee_name");
>> grantsDTO.setGrantNumber("grantNumber");
>> marshaller.marshal(grantsDTO, new File("c:\\test.xml"));
>>
>> }
>>
>>
>>
>> }
>>
>> here my grantsDTO
>>
>> package gov.hhs.acf.util.ws.grants.model;
>>
>> import javax.xml.bind.annotation.XmlRootElement;
>>
>>
>> @XmlRootElement
>> public class GrantsDTO {
>>
>> private String grantNumber;
>>
>> private String granteeName;
>>
>> public String getGrantNumber() {
>> return grantNumber;
>> }
>>
>> public void setGrantNumber(String grantNumber) {
>> this.grantNumber = grantNumber;
>> }
>>
>> public String getGranteeName() {
>> return granteeName;
>> }
>>
>> public void setGranteeName(String granteeName) {
>> this.granteeName = granteeName;
>> }
>>
>>
>>
>> }
>> I end up with this exception please tell what is this error and how to
>> resolve this ?
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/new-bee-jaxb-tp27801706p27801706.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
>>
>>
>
>

-- 
View this message in context: http://old.nabble.com/new-bee-jaxb-tp27801706p27804039.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.