dea*_*mon -2 java grails groovy comparable sortedset
我想使用SortedSetGrails,但我得到的只是一个MissingMethodException.
包含有序集的类如下所示:
class SystemUser {
SortedSet organisations
// ... some other fields
static hasMany = [organisations: Organisation]
static belongsTo = [Organisation]
}
Run Code Online (Sandbox Code Playgroud)
......以及Comparable像这样实现的类:
class Organisation implements Comparable {
String name
// ... some other fields
static hasMany = [users: SystemUser]
int compareTo(other) {
return name.comparteTo(other.name)
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试保存SystemUser对象时,我收到此异常消息:
groovy.lang.MissingMethodException: No signature of method: java.lang.String.comparteTo() is applicable for argument types: (java.lang.String) values: [ABC]
Possible solutions: compareTo(java.lang.String), compareTo(java.lang.Object)
Run Code Online (Sandbox Code Playgroud)