/** * Get the size description associated with the given key. If the key * doesn't map to an existing object, the defaultValue is returned. * * @param key * @param defaultValue * @return the associated size description if key is found, defaultValue * otherwise */ public long getSize(String key, long defaultValue) { return getOrDefault(key, Interpreters.numberOfBytes(), defaultValue); }
/** * Get the enum value associated with the given key. If the key doesn't map * to an existing object or the mapped value is not a valid enum, the * defaultValue is returned * * @param key * @param defaultValue * @return the associated enum if key is found, defaultValue * otherwise */ @SuppressWarnings("unchecked") public <T extends Enum<T>> T getEnum(String key, T defaultValue) { return getOrDefault(key, Interpreters.enumValue(defaultValue.getClass()), defaultValue); } }