protostuff icon indicating copy to clipboard operation
protostuff copied to clipboard

I trying to serialize this class below but failed.v1.0

Open hetianyi opened this issue 7 years ago • 1 comments

public class ServiceRequest implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private String serviceid;
    private ServiceMethodEntity methodEntity;
    private Map<String, String> parameter = null;

    public ServiceMethodEntity getMethodEntity() {
        return methodEntity;
    }
    public void setMethodEntity(ServiceMethodEntity methodEntity) {
        this.methodEntity = methodEntity;
    }
    public void addParameter(String name, String value){
        if(null == this.parameter)
            parameter = new HashMap<String, String>();
        this.parameter.put(name, value);
    }
    public String getParameter(String name){
        if(null == this.parameter)
            return null;
        return this.parameter.get(name);
    }
    public String getServiceid() {
        return serviceid;
    }
    public void setServiceid(String serviceid) {
        this.serviceid = serviceid;
    }
}
public class ServiceMethodEntity implements Serializable{
    public static int LESS = 1;
    public static int MORE = 2;
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private Class<?> obejctClass;

    private String methodName;

    private Object[] args;

    private Class<?>[] argsTypes;

    private int type = ServiceMethodEntity.LESS;

    public ServiceMethodEntity() {
    }

    public ServiceMethodEntity(Class<?> obejctClass, String methodName, Object[] args) {
        this.methodName = methodName;
        this.obejctClass = obejctClass;
        this.args = args;
    }

    public String getMethodName() {
        return methodName;
    }
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
    public Object[] getArgs() {
        return args;
    }
    public void setArgs(Object[] args) {
        this.args = args;
    }

    public Class<?> getObejctClass() {
        return obejctClass;
    }

    public void setObejctClass(Class<?> obejctClass) {
        this.obejctClass = obejctClass;
    }

    public Class<?>[] getArgsTypes() {
        return argsTypes;
    }

    public void setArgsTypes(Class<?>[] argsTypes) {
        this.argsTypes = argsTypes;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }   
}

hetianyi avatar Jul 08 '16 03:07 hetianyi

What's the stacktrace? Please post a sample test case that uses this class and triggers the exception?

dyu avatar Jul 08 '16 09:07 dyu