/** * Get a credential with realm and name. * * @param realm The credential realm. * @param name The username. * @return The credential, or null if not found. */ public Password get(String realm, String name) { return super.get(String.format("%s:%s:", realm, name)); }
@Override public Password get(Object key) { // Make it compatible with the old way (low-efficient) if (key instanceof String && !((String) key).contains(":")) { return getByUsername((String) key); } return super.get(key); }
/** * Creates an entity in this collection. * * @param name The name of the entity. * @param args Arguments for creating the entity. * @return The entity. */ public T create(String name, Map args) { args = Args.create(args).add("name", name); service.post(path, args); invalidate(); return get(name); }