简体   繁体   中英

How to use Grails belongsTo in Java

I have this situation in grails

static belongsTo = [owner: Publisher]

How can I convert this in java?

The short answer is You can not convert it to java.

The longer answer, and reason why, is because that static property is used by Grails to enhance your class with additional methods and functionality using Groovy meta programming. This type of meta programming isn't available in Java and one of the primary reasons why Groovy is used in this case.

Without knowing why you want to do so it's impossible to suggest any alternative approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM