/** returns a configurable shortener */ public static StringShortener shortener() { return new StringShortener(); }
StringShortener shortener = Strings.shortener().separator("-"); shortener.append("system", "brooklyn"); append("randId", Identifiers.makeRandomId(4)); shortener.append("user", user); if (app!=null) { shortener. append("app", shortName(app)). append("appId", app.getId()); shortener.append("entity", shortName(entity)). append("entityId", entity.getId()); } else if (context!=null) { shortener.append("context", context.toString()); truncate("user", 12). truncate("app", 16). truncate("entity", 16). truncate("appId", 4). truncate("entityId", 4). truncate("context", 12); canTruncate("user", 8). canTruncate("app", 5). canTruncate("entity", 5). canTruncate("system", 2). canTruncate("app", 3).