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.

1  
sclass GazAICredentials {
2  
  settable S user;
3  
  settable S password;
4  
5  
  toString {
6  
    ret joinNempties(" with ",
7  
      shortClassName(this),
8  
      nempty(user) ? "user " + user : null,
9  
      nempty(password) ? "password" : null);
10  
  }
11  
  
12  
  static GazAICredentials fromFile(File f) {
13  
    var credMap = parseColonPropertyCIMap(loadTextFile(f));
14  
15  
    var cred = new GazAICredentials;
16  
    cred.user(credMap.get("user");
17  
    cred.password(credMap.get("password");
18  
    ret cred;
19  
  }
20  
  
21  
  void save(File f) {
22  
    saveTextFile(f, formatColonProperties(litorderedmap(
23  
      +user,
24  
      +password
25  
    )));
26  
  }
27  
  
28  
  Map asParams() {
29  
    ret litorderedmap(+user, pw := password);
30  
  }
31  
}

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: 127 / 196
Version history: 6 change(s)
Referenced in: [show references]