No suitable constructor found for type [simple type, class com.beiyanght.dxhbm.vehiclemanagement.business.Student.dto.StudentCondition]: can not insta

package com.beiyanght.dxhbm.vehiclemanagement.business.Student.dto;

import java.io.IOException;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.wakeframework.utils.JsonHelper;


/**
 * @功能名 Student - 查询条件
 * @类描述 数据传输对象
 * @author
 * @Date 2014-3-20
 */
public class StudentCondition {

    /**
     * 学生姓名
     */
    private String name ;
    /**
     * 学号
     */
    private String no ;
    /**
     * 性别
     */
    private String sex ;
    /**
     * 年龄
     */
    private int age ;
    /*-----------------构造方法(@QueryParam 注入需要) -------------------------------*/
    public StudentCondition (String json){
        
    }
   

    public static StudentCondition valueOf(String json) throws JsonParseException, JsonMappingException, IOException {
        StudentCondition condition = JsonHelper.getBean(json, StudentCondition.class) ;
        return condition ;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

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

出现该异常:是因为该类中缺少一个缺省构造

需要添加缺省构造函数

public StudentCondition() {
        super();
        // TODO Auto-generated constructor stub
    }

不然其他类中不可定义该类对象

 

posted @ 2014-03-20 17:00  菜鸟搞IT  阅读(2666)  评论(0编辑  收藏  举报