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
        }

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

  • 相关阅读:
    Appium
    iOS 定位方式 iOSNsPredicateString 详解
    Appium 遇到 Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65 的解决方法
    自动化工具 appium 在真机上测试的配置 (使用个人 Apple ID)
    查看iOS App的bundleId
    阿里巴巴热招求推荐求转发
    一文读懂网络协议
    Idea生成Javadoc
    系统监控
    Hystrix使用详解
  • 原文地址:https://www.cnblogs.com/myitmylife/p/3614133.html
Copyright © 2011-2022 走看看