我正面临这个错误
groovy.lang.GroovyRuntimeException:找不到匹配的构造函数:AnimalInfoType(java.lang.String,java.lang.Integer,java.lang.Integer)时
通过“run-app”启动应用程序,我为 Enum 创建了构造函数,如下所示:
package jogoanimais
public enum AnimalInfoType
{
ANIMAL(1),
ACTION(2)
final int value
private AnimalInfoType(int value) {
this.value = value
}
int value() { value }
}
我的域类是这样的:
class AnimaisTreeMap {
String nodeDescription
AnimalInfoType nodeInfo
AnimaisTreeMap yesAnswerNode
AnimaisTreeMap noAnswerNode
static constraints = {
yesAnswerNode nullable:true
noAnswerNode nullable:true
}
static mappedBy = [ yesAnswerNode: "none", noAnswerNode: "none" ]
static mapping = {
yesAnswerNode cascade: 'delete'
noAnswerNode cascade: 'delete'
}
}
在我的 BootStrap.groovy 中,我像这样填写表格:
def noAnswer = new AnimaisTreeMap(nodeDescription:"macaco",
nodeInfo: AnimalInfoType.ANIMAL,
noAnswerNode:null,
yesAnswerNode:null)
noAnswer.save(failOnError: true)
def yesAnswer = new AnimaisTreeMap(nodeDescription:"tubarão",
nodeInfo: AnimalInfoType.ANIMAL,
noAnswerNode:null,
yesAnswerNode:null)
yesAnswer.save(failOnError: true)
new AnimaisTreeMap(nodeDescription:"vive na água",
nodeInfo: AnimalInfoType.ACTION,
noAnswerNode: noAnswer,
yesAnswerNode: yesAnswer).
save(failOnError: true)
}
我在 BootStrap.groovy 做错了什么?