- Kotlin for Enterprise Applications using Java EE
- Raghavendra Rao K
- 159字
- 2021-06-10 18:49:29
No-arg compiler plugin
Constructors are used to initialize the states of an object. Sometimes, however, we need to have default constructors that take no arguments. The no-arg compiler plugin is used to generate no-arg constructors (the default constructors) for classes that are annotated with a particular annotation. When we have a no-arg compiler plugin enabled, a no-arg constructor is added during compile-time. The generated default constructor can only be invoked by the reflection APIs and are not accessible directly from the Kotlin code. The no-arg compiler plugin enables the CDI or the JPA to instantiate the classes, though it doesn't have any default constructors defined in the code.
In Java, a default constructor will always be added to the compiled code by the compiler and no additional plugin is required to do this. In Kotlin, however, when we have the no-arg compiler plugin enabled , a default constructor will be added to the compiled code.
推薦閱讀
- Mastering OpenLayers 3
- Learning Bayesian Models with R
- Java:Data Science Made Easy
- Visual Basic程序設(shè)計(jì)與應(yīng)用實(shí)踐教程
- Java程序設(shè)計(jì):原理與范例
- Gradle for Android
- Visual C++開(kāi)發(fā)入行真功夫
- 新一代SDN:VMware NSX 網(wǎng)絡(luò)原理與實(shí)踐
- 百萬(wàn)在線:大型游戲服務(wù)端開(kāi)發(fā)
- Java多線程并發(fā)體系實(shí)戰(zhàn)(微課視頻版)
- Java EE 7 Development with WildFly
- ASP.NET本質(zhì)論
- Opa Application Development
- Python3從入門(mén)到實(shí)戰(zhàn)
- Twitter Bootstrap Web Development How-to