zoukankan      html  css  js  c++  java
  • 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
        }

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

  • 相关阅读:
    3574. 乘积数量
    1357. 优质牛肋骨
    1356. 回文质数
    3554. 二进制
    13 vue路由跳转传参
    12 el-form的inline属性
    10 js数组赋值问题
    9 彻底搞懂json字符串和json对象
    8 element自定义卡槽的好处
    7 el-table表格中使用Dropdown 下拉菜单无法显示下拉框的问题
  • 原文地址:https://www.cnblogs.com/myitmylife/p/3614133.html
Copyright © 2011-2022 走看看