Share My Creation Class Generator

Hello,

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



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



Select All

Paste the code


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: 156
  • example.zip
    2.5 KB · Views: 150
Cookies are required to use this site. You must accept them to continue using the site. Learn more…