Parameters implements Serializable, Map<String,Object> { @Nonnull public static Parameters parseMap(Map<String,String> map) { Parameters self = Parameters.create(); for (String key : map.keySet()) { self.put(key, JSONUtil.parseString(map.get(key))); } return self; } private  Parameters(); private  Parameters(Map<String, Object> data); @Nonnull static Parameters create(); @Deprecated static Parameters instance(); @Nonnull static Parameters parseMap(Map<String,String> map); @Nonnull @SuppressWarnings("unchecked") static Parameters wrap(Map<String, T> data); @Nonnull static Parameters parseFile(File f); @Nonnull static Parameters parseFile(String path); @Nonnull static Parameters parseString(String data); @Nonnull static Parameters parseStringOrDie(String data); @Nonnull static Parameters parseReader(Reader reader); @Nonnull static Parameters parseStream(InputStream iStream); @Nonnull static Parameters parseBytes(byte[] data); @Nonnull static Parameters parseArray(Object... args); void copyFrom(@Nonnull Parameters other); void copyTo(@Nonnull Parameters other); @Override int hashCode(); @Override boolean equals(Object o); boolean valueEquals(Object lhs, Object rhs); @Nonnull @Override Parameters clone(); @Nonnull Set<String> getKeys(); @Nonnull List<T> getList(String key, Class<T> klazz); @Nonnull List getList(String key); @Nonnull List getAsList(String key); @Nonnull List<T> getAsList(String key, Class<T> ignored); @Nonnull Parameters getMap(String key); @Nonnull String getAsString(String key); @Nullable String getString(String key); Parameters get(String key, Parameters def); String get(String key, String def); long getLong(String key); int getInt(String key); long get(String key, long def); int get(String key, int def); double getAsDouble(String key); double getDouble(String key); double get(String key, double def); boolean getBoolean(String key); boolean get(String key, boolean def); @Nullable Parameters getBackoff(); void set(String key, Parameters value); void set(String key, Collection<T> value); void set(String key, Object[] value); void set(String key, String value); void set(String key, long value); void set(String key, double value); void set(String key, boolean value); void setBackoff(Parameters backoff); @Deprecated void setFinalBackoff(Parameters backoff); boolean remove(String key); boolean isString(String key); boolean isList(String key); boolean isList(String key, Class<T> klazz); void extendList(String key, T obj); void extendList(String key, Collection<T> coll); boolean isMap(String key); boolean isDouble(String key); boolean isLong(String key); boolean isBoolean(String key); boolean containsKey(String key); boolean isEmpty(); void write(String filename); @Override String toString(); String toPrettyString(); String toPrettyString(String prefix); static Parameters parseArgs(String[] args); @Override int size(); @Override boolean containsKey(Object o); @Override boolean containsValue(Object o); @Override Object get(Object o); @Nonnull Object getOrThrow(String key); void putIfNotNull(String k, Object v); @Override Object put(String k, Object v); void setIfMissing(String k, Object v); @Override Object remove(Object o); @Override void putAll(Map<? extends String, ?> map); @Override void clear(); @Override Set<String> keySet(); @Override Collection<Object> values(); @Override Set<Entry<String, Object>> entrySet();  }
@Test public void testParseMap() { Map<String,String> data = new HashMap<>(); data.put("keyA", "0"); data.put("keyB", "1"); Parameters test = Parameters.parseMap(data); assertEquals(0, test.getLong("keyA")); assertEquals(1, test.getLong("keyB")); assertEquals("0", test.getAsString("keyA")); assertEquals("1", test.getAsString("keyB")); assertEquals(data.size(), test.size()); }