作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
GrailsDomainClass类具有两种方法:getProperties
和getPersistentProperties
我有一个域类(MyDomainClass
),其中包括:
static transients = {computeStuff}
float computeStuff(){
def thisCouldChange = 3.1
return thisCouldChange //it actually does things but not of consequence to my question
}
MyDomainClass
的所有属性,如下所示:
<g:each var="d" in="${grailsApplication.domainClasses.sort { it.fullName } }">
<h2>${d.fullName}</h2>
<g:each var="f" in="${d.properties.sort { it.fieldName } }">
<br>${f.fieldName }
</g:each>
</g:each>
static transients = ['computeStuff']
float getComputeStuff(){
def thisCouldChange = 3.1
return thisCouldChange //it actually does things but not of consequence to my question
}
最佳答案
去除静态 transient 脱纤。定义您的方法如下:
def getComputeStuff(){
def thisCouldChange = 3.1
return 3.1 //it actually does things but not of consequence to my question
}
关于grails - Grails domainClasses获得临时属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6379775/
grails 有 findAllBy* 的文档,但它不会告诉您它返回什么,或如何使用它。例如。 def results = Book.findAllByTitleLike("%Hobbit%) 结果是
我很难找到有关 grails 功能的信息: DomainClass.properties = params 在我的特殊情况下,我有这些类: class parameterType = { String
是否有比DomainClass.findAll()[0]短/干净的方法来检索通常由findAll()检索的域对象集中的第一个域对象? 理想情况下,我想要DomainClass.find(),但是这种查
各位,我遇到了 grails GORM 的问题,我的应用程序完全依赖于 DomainClass.list() 方法,它在我所有的创建中/edit GSP,但现在我需要一个特定的行为来列出对象。更具体地
我是一名优秀的程序员,十分优秀!