枚举类 get Set方法 在lombok中的坑

原创
2019/06/24 20:51
阅读数 4.2K

lombok的类如下所示:

package com.divx.service.model.task;

import com.divx.service.model.BaseTypeMedia;
import lombok.Data;

/**
 * @author wuzhilang
 * @Title: QuestionResult
 * @ProjectName yxt-parent
 * @Description: QuestionResult
 * @date 2019/6/2015:59
 */
@Data
public class QuestionResult {
	private long questionId;
	private BaseTypeMedia.eQuestionType qType;
	private String userAnswer;
	private String standardAnswer;
	private long userId;
	private int instId;
	private Boolean result;
	private String word;


}

结果属性里面 private BaseTypeMedia.eQuestionType qType;的get方法是

getQType();

导致我前端传过来的参数没有被接收到。 用idea生成的getsetter 方法如下:

package com.divx.service.model.task;

import com.divx.service.model.BaseTypeMedia;
import lombok.Data;

/**
 * @author wuzhilang
 * @Title: QuestionResult
 * @ProjectName yxt-parent
 * @Description: QuestionResult
 * @date 2019/6/2015:59
 */
public class QuestionResult {
	private long questionId;
	private BaseTypeMedia.eQuestionType qType;
	private String userAnswer;
	private String standardAnswer;
	private long userId;
	private int instId;
	private Boolean result;
	private String word;

	public long getQuestionId() {
		return questionId;
	}

	public void setQuestionId(long questionId) { 
		this.questionId = questionId;
	}
//别找了就是这个方法
	public BaseTypeMedia.eQuestionType getqType() {
		return qType;
	}

	public void setqType(BaseTypeMedia.eQuestionType qType) {
		this.qType = qType;
	}

	public String getUserAnswer() {
		return userAnswer;
	}

	public void setUserAnswer(String userAnswer) {
		this.userAnswer = userAnswer;
	}

	public String getStandardAnswer() {
		return standardAnswer;
	}

	public void setStandardAnswer(String standardAnswer) {
		this.standardAnswer = standardAnswer;
	}

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public int getInstId() {
		return instId;
	}

	public void setInstId(int instId) {
		this.instId = instId;
	}

	public Boolean getResult() {
		return result;
	}

	public void setResult(Boolean result) {
		this.result = result;
	}

	public String getWord() {
		return word;
	}

	public void setWord(String word) {
		this.word = word;
	}
}

对的你没看错

public void setQuestionId(long questionId) { 
		this.questionId = questionId;
	}

	public BaseTypeMedia.eQuestionType getqType() {
		return qType;
	}

get set方法是这个样子的。

有没有大神来解释下,为什么

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部