public static Consumer url2Consumer(Pair<Long, URL> pair) { if (pair == null) { return null; } Long id = pair.getKey(); URL url = pair.getValue(); if (null == url) return null; Consumer c = new Consumer(); c.setId(id); c.setService(url.getServiceKey()); c.setAddress(url.getHost()); c.setApplication(url.getParameter(Constants.APPLICATION_KEY)); c.setParameters(url.toParameterString()); return c; }