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

31
LINES

< > BotCompany Repo | #1036192 // GazAICredentials

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

Transpiled version (9912L) is out of date.

sclass GazAICredentials {
  settable S user;
  settable S password;

  toString {
    ret joinNempties(" with ",
      shortClassName(this),
      nempty(user) ? "user " + user : null,
      nempty(password) ? "password" : null);
  }
  
  static GazAICredentials fromFile(File f) {
    var credMap = parseColonPropertyCIMap(loadTextFile(f));

    var cred = new GazAICredentials;
    cred.user(credMap.get("user");
    cred.password(credMap.get("password");
    ret cred;
  }
  
  void save(File f) {
    saveTextFile(f, formatColonProperties(litorderedmap(
      +user,
      +password
    )));
  }
  
  Map asParams() {
    ret litorderedmap(+user, pw := password);
  }
}

Author comment

Began life as a copy of #1036019

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036192
Snippet name: GazAICredentials
Eternal ID of this version: #1036192/7
Text MD5: a82490676284717ce6a017227e0fb8ba
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-16 16:19:58
Source code size: 703 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 64 / 108
Version history: 6 change(s)
Referenced in: [show references]