Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1033794 // Tok_SettableFields

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6200L/35K).

sclass Tok_SettableFields > Tok_SettableOrGettableFields {

  *() {
    super("settable");
    recognizedModifiers = listPlus(recognizedModifiers, "void");
  }
  
  S replacement() {
    bool returnThis = !contains(modifiers, "void");
    S returnType = returnThis ? "selfType" : "void";
    ret tok_formatDollarVars(
      "$fMod $returnType $var aka $setVar($type $var) { this.$var = $var; $returnStatement } gettable $modifiers $type",
      fMod := joinWithSpace(functionModifiers()) + " public",
      modifiers := joinWithSpace(listMinus(modifiers, "void")),
      +type, +var, +returnType,
      $returnStatement := returnThis ? "this;" : "",
      setVar := "set" + firstToUpper(var));
  }
}

Author comment

Began life as a copy of #1033793

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033794
Snippet name: Tok_SettableFields
Eternal ID of this version: #1033794/8
Text MD5: 67396a54d9dd79fe6a47252bc3e2f168
Transpilation MD5: 725890d0fc556a2ffada6c431cfc4434
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-03 03:03:59
Source code size: 717 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 98 / 186
Version history: 7 change(s)
Referenced in: [show references]