Grails 中的 SortedSet 不起作用
我想在 Grails 中使用 SortedSet
,但我得到的只是 MissingMethodException。
包含排序集的类如下所示:
class SystemUser {
SortedSet organisations
// ... some other fields
static hasMany = [organisations: Organisation]
static belongsTo = [Organisation]
}
... 实现 Comparable 的类如下所示:
class Organisation implements Comparable {
String name
// ... some other fields
static hasMany = [users: SystemUser]
int compareTo(other) {
return name.comparteTo(other.name)
}
}
当我尝试保存 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)
我的示例几乎与来自官方参考的示例。
I want to use a SortedSet
with Grails, but all I get is a MissingMethodException.
The class that contains the sorted set looks like this:
class SystemUser {
SortedSet organisations
// ... some other fields
static hasMany = [organisations: Organisation]
static belongsTo = [Organisation]
}
... and the class implementing Comparable
like this:
class Organisation implements Comparable {
String name
// ... some other fields
static hasMany = [users: SystemUser]
int compareTo(other) {
return name.comparteTo(other.name)
}
}
When I try to save a SystemUser object I get this Exception message:
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)
My example is almost identical with the example from the official reference.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在看到问题了吗?
See the problem now?