public static AuthMaskingProperties fromAnyProperties(Properties p) { AuthMaskingProperties out = new AuthMaskingProperties(); for (Enumeration e = p.propertyNames(); e.hasMoreElements(); ) { String key = (String) e.nextElement(); out.setProperty(key, p.getProperty(key)); } return out; }
public String toString() { boolean hasUser = (this.get("user") != null); boolean hasPassword = (this.get("password") != null); if (hasUser || hasPassword) { AuthMaskingProperties clone = (AuthMaskingProperties) this.clone(); if (hasUser) clone.put("user", "******"); if (hasPassword) clone.put("password", "******"); return clone.normalToString(); } else return this.normalToString(); }