- JBoss:Developer's Guide
- Elvadas Nono Woguia
- 191字
- 2021-07-02 18:37:24
Adding attributes to classes
To add a private name property with getters and setters to the HelloJBossWorld class, use the java-new-field Forge command. This command is applied to the selected classes:
[HelloJBossWorld.java]$ java-new-field
***INFO*** Required inputs not satisfied, entering interactive mode
[0] (x) com.beosbank.forge.demo.HelloJBossWorld
Press <ENTER> to confirm, or <CTRL>+C to cancel.
* Target Class (The class where the field will be created): [0] 0
* Field Name (The field name to be created in this class): name
* Field Type (The type intended to be used for this field) [String]:
[0] ( ) public
[1] ( ) protected
[2] (x) private
[3] ( ) default
Press <ENTER> to confirm, or <CTRL>+C to cancel.
? Access Type (The access type): [0-3] 2
? Generate Getter (Generate accessor method) [Y/n]: Y
? Generate Setter (Generate mutator method) [Y/n]: Y
? Update toString (Updates the toString method by adding the field) [Y/n]:Y
***SUCCESS*** Field name created
We now have a mini project set up with a single class. Forge commands are not only used to create a project's objects but can also serve as gateways to interact with project builder tools such as maven.
推薦閱讀
- HTML5+CSS3王者歸來
- Java多線程編程實戰(zhàn)指南:設(shè)計模式篇(第2版)
- 大學計算機應(yīng)用基礎(chǔ)實踐教程
- Vue.js前端開發(fā)基礎(chǔ)與項目實戰(zhàn)
- x86匯編語言:從實模式到保護模式(第2版)
- Mastering Ubuntu Server
- 精通Scrapy網(wǎng)絡(luò)爬蟲
- Full-Stack Vue.js 2 and Laravel 5
- OpenShift在企業(yè)中的實踐:PaaS DevOps微服務(wù)(第2版)
- Building an RPG with Unity 2018
- 程序是怎樣跑起來的(第3版)
- Visual C#.NET程序設(shè)計
- Learning Raspbian
- Learning OpenCV 3 Computer Vision with Python(Second Edition)
- Java網(wǎng)絡(luò)編程核心技術(shù)詳解(視頻微課版)