@Test(expected=JSON.DataException.class) public void testGetNonNullNullKey() throws JSON.DataException { final Map<String,Object> json = new HashMap<String,Object>(); JSON.getNonNull(json, null); }
public static Object getNonNull(Map<String,Object> json, String key) throws DataException { if (key == null) { throw new DataException("key is null"); } if (!json.containsKey(key)) { throw new DataException(key + " does not exist in " + json); } final Object o = json.get(key); if (o == null) { throw new DataException("value for " + key + " is null"); } return o; }
JSON { public static Object getNonNull(Map<String,Object> json, String key) throws DataException { if (key == null) { throw new DataException("key is null"); } if (!json.containsKey(key)) { throw new DataException(key + " does not exist in " + json); } final Object o = json.get(key); if (o == null) { throw new DataException("value for " + key + " is null"); } return o; } }
JSON { public static Object getNonNull(Map<String,Object> json, String key) throws DataException { if (key == null) { throw new DataException("key is null"); } if (!json.containsKey(key)) { throw new DataException(key + " does not exist in " + json); } final Object o = json.get(key); if (o == null) { throw new DataException("value for " + key + " is null"); } return o; } protected  JSON(); }
JSON { public static Object getNonNull(Map<String,Object> json, String key) throws DataException { if (key == null) { throw new DataException("key is null"); } if (!json.containsKey(key)) { throw new DataException(key + " does not exist in " + json); } final Object o = json.get(key); if (o == null) { throw new DataException("value for " + key + " is null"); } return o; } protected  JSON(); static T getAs(Map<String,Object> json, String key, Class<T> type); static Object getNonNull(Map<String,Object> json, String key); }
JSON { public static Object getNonNull(Map<String,Object> json, String key) throws DataException { if (key == null) { throw new DataException("key is null"); } if (!json.containsKey(key)) { throw new DataException(key + " does not exist in " + json); } final Object o = json.get(key); if (o == null) { throw new DataException("value for " + key + " is null"); } return o; } protected  JSON(); static T getAs(Map<String,Object> json, String key, Class<T> type); static Object getNonNull(Map<String,Object> json, String key);  }