axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Turner <>
Subject Deserializer (MethodTarget, FieldTarget)
Date Fri, 05 Apr 2002 14:32:34 GMT
I've posted a couple of messages already both to the user and dev lists,
but got no response.

I've been trying to write my own deserializer for the following simple
class which is based on your encoding example:

public class Data
    private String name;
    private int age;

    public Data() {}

    pubic Data(String name, int age)
    { = name;
        this.age = age;

    public void setName(String name)
    { = name;

    public String getName() { return; }

    public void setAge(int age)
        this.age = age;

    public int getAge() { return this.age; }


What doesn't work is the parameter to the method registerValueTarget(new
FieldTarget(value, localname)) or registerValueTarget(new
MethodTarget(value, methodName)).

Using FieldTarget requires that the class being deserialized have public
field members. FieldTarget is using Class.getField() which only works on
public fields.

MethodTarget, on the other hand doesn't work either.  I pass in the name
of the method so it can set the private field, but it can't find it
because MethodTarget is using Class.getMethod(methodName, Class[] {
Object.class }).  My setters have a String parameter and the other has a
int parameter.  MethodTarget can't find my method because it's looking
for an Object parameter in the method parm list.

I need to deserialize and serialize some complex objects in my project,
but this is stopping me.  I need to have something that goes beyond the

I could use some help and/or feedback.



View raw message