@Test(expected=IllegalArgumentException.class) public void testSetPropertiesWithNullObject() { PropertyUtil.setProperties(null, new HashMap<String, String>()); }
public static Map<String, String> setProperties(Object target, Map<String, String> properties) { if (target == null) { throw new IllegalArgumentException("target object cannot be null"); } if (properties == null) { throw new IllegalArgumentException("Given Properties object cannot be null"); } Map<String, String> unmatched = new LinkedHashMap<String, String>(); for (Map.Entry<String, String> entry : properties.entrySet()) { if (!setProperty(target, entry.getKey(), entry.getValue())) { unmatched.put(entry.getKey(), entry.getValue()); } } return Collections.unmodifiableMap(unmatched); }
PropertyUtil { public static Map<String, String> setProperties(Object target, Map<String, String> properties) { if (target == null) { throw new IllegalArgumentException("target object cannot be null"); } if (properties == null) { throw new IllegalArgumentException("Given Properties object cannot be null"); } Map<String, String> unmatched = new LinkedHashMap<String, String>(); for (Map.Entry<String, String> entry : properties.entrySet()) { if (!setProperty(target, entry.getKey(), entry.getValue())) { unmatched.put(entry.getKey(), entry.getValue()); } } return Collections.unmodifiableMap(unmatched); } }
PropertyUtil { public static Map<String, String> setProperties(Object target, Map<String, String> properties) { if (target == null) { throw new IllegalArgumentException("target object cannot be null"); } if (properties == null) { throw new IllegalArgumentException("Given Properties object cannot be null"); } Map<String, String> unmatched = new LinkedHashMap<String, String>(); for (Map.Entry<String, String> entry : properties.entrySet()) { if (!setProperty(target, entry.getKey(), entry.getValue())) { unmatched.put(entry.getKey(), entry.getValue()); } } return Collections.unmodifiableMap(unmatched); }  }
PropertyUtil { public static Map<String, String> setProperties(Object target, Map<String, String> properties) { if (target == null) { throw new IllegalArgumentException("target object cannot be null"); } if (properties == null) { throw new IllegalArgumentException("Given Properties object cannot be null"); } Map<String, String> unmatched = new LinkedHashMap<String, String>(); for (Map.Entry<String, String> entry : properties.entrySet()) { if (!setProperty(target, entry.getKey(), entry.getValue())) { unmatched.put(entry.getKey(), entry.getValue()); } } return Collections.unmodifiableMap(unmatched); }  static URI replaceQuery(URI originalURI, Map<String, String> properties); static URI replaceQuery(URI uri, String query); static URI eraseQuery(URI uri); static String createQueryString(Map<String, ? extends Object> options); static Map<String, String> parseQuery(URI uri); static Map<String, String> parseQuery(String queryString); static Map<String, String> filterProperties(Map<String, String> properties, String optionPrefix); static Map<String, String> setProperties(Object target, Map<String, String> properties); static Map<String, Object> setProperties(Object target, Properties properties); static Map<String, String> getProperties(Object object); static Object getProperty(Object object, String name); static boolean setProperty(Object target, String name, Object value); static String stripPrefix(String value, String prefix); static String stripUpto(String value, char c); static String stripBefore(String value, char c); }
PropertyUtil { public static Map<String, String> setProperties(Object target, Map<String, String> properties) { if (target == null) { throw new IllegalArgumentException("target object cannot be null"); } if (properties == null) { throw new IllegalArgumentException("Given Properties object cannot be null"); } Map<String, String> unmatched = new LinkedHashMap<String, String>(); for (Map.Entry<String, String> entry : properties.entrySet()) { if (!setProperty(target, entry.getKey(), entry.getValue())) { unmatched.put(entry.getKey(), entry.getValue()); } } return Collections.unmodifiableMap(unmatched); }  static URI replaceQuery(URI originalURI, Map<String, String> properties); static URI replaceQuery(URI uri, String query); static URI eraseQuery(URI uri); static String createQueryString(Map<String, ? extends Object> options); static Map<String, String> parseQuery(URI uri); static Map<String, String> parseQuery(String queryString); static Map<String, String> filterProperties(Map<String, String> properties, String optionPrefix); static Map<String, String> setProperties(Object target, Map<String, String> properties); static Map<String, Object> setProperties(Object target, Properties properties); static Map<String, String> getProperties(Object object); static Object getProperty(Object object, String name); static boolean setProperty(Object target, String name, Object value); static String stripPrefix(String value, String prefix); static String stripUpto(String value, char c); static String stripBefore(String value, char c);  }