欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2022-06-15 13:38:22
...

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方法是这个样子的。

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

转载于:https://my.oschina.net/u/3694754/blog/3065708