/** * Returns the job's unique search identifier (SID), which is used as this * item's key. * * @param entry The {@code AtomEntry} response. * @return This job's SID. */ @Override protected String itemKey(AtomEntry entry) { return (String)entry.content.get("sid"); } }
/** * Returns the value associated with the given key, cast to the given type * parameter. * * @param key The key of the value being retrieved. * @param <T> The type to cast the return value to. * @return The value associated with the given key, cast to the given type. */ <T> T getValue(String key) { return (T)get(key); }
/** * Returns the {@code String} value associated with the given key. * * @param key The key of the value being retrieved. * @return The value associated with the given key. */ String getString(String key) { return get(key).toString(); }
/** * Returns the {@code String[]} value associated with the given key. * * @param key The key of the value being retrieved. * @return The value associated with the given key. */ String[] getStringArray(String key) { List<String> value = (List<String>)get(key); return value.toArray(new String[value.size()]); }
/** {@inheritDoc} */ public Object get(Object key) { if (toUpdate.containsKey(key)) return toUpdate.get(key); return getContent().get(key); }
/** * Returns the {@code String} value associated with the given key, or * {@code defaultValue} if the key does not exist. * * @param key The key of the value being retrieved. * @param defaultValue The value to return if the key does not exist. * @return The value associated with the given key, or {@code defaultValue} * if the key does not exist. */ String getString(String key, String defaultValue) { if (!containsKey(key)) return defaultValue; return get(key).toString(); }
/** * Returns the value associated with the given key, or {@code defaultValue} * if the key does not exist, cast to the given type parameter. * * @param key The key of the value being retrieved. * @param defaultValue The value to return if the key does not exist. * @param <T> The type to cast the return value to. * @return The value associated with the given key, or {@code defautlValue} * if the key does not exist. */ <T> T getValue(String key, T defaultValue) { if (!containsKey(key)) return defaultValue; return (T)get(key); } }
private Args namespace(AtomEntry entry) { Args namespace = new Args(); // no content? return an empty namespace. if (entry.content == null) return namespace; HashMap<String, String> entityMetadata = (HashMap<String, String>)entry.content.get("eai:acl"); // If there is no ACL info, we just create an empty map if (entityMetadata == null) { entityMetadata = new HashMap<String, String>(); } if (entityMetadata.containsKey("owner")) namespace.put("owner", entityMetadata.get("owner")); if (entityMetadata.containsKey("app")) namespace.put("app", entityMetadata.get("app")); if (entityMetadata.containsKey("sharing")) namespace.put("sharing", entityMetadata.get("sharing")); return namespace; }