Share My Creation Class Generator

Hello,

This a small class generator. The class use this concept, thanks to @Emme Developer.

1650219464495.png


Enter the Class Name

Enter the fields list (Name, Type and Default Value).
Click on the 'Copy' button

In your Project, add a Standard Class module with the same class name
1650219503105.png

1650219524664.png


Select All
1650219549139.png

Paste the code
1650219607192.png


You can choose the prefix for Class Name, Field Name, Getter and Setter.
You can deactivate Getter and/or Setter for each field with B4XSwitch

The example.zip is a project which use the generated class.

use the class:
    'declare a variable
    Dim p As cPerson
    
    'initialize a new person and set values
    p.Initialize.sFirstName("Mark").sLastName("Twain").sAge(30)
    
    'clone person in a new variable and change values
    Dim r As cPerson=p.clone.sAge(50).sLastName("Knopfler")
    
    'get value
    log(p.gFirstName)
    log(p.gLastName)
    log(p.gAge)







That's all.

spsp
 

Attachments

  • classgenerator.zip
    5.4 KB · Views: 234
  • example.zip
    2.5 KB · Views: 230
Top