List of usage examples for com.google.gson.reflect TypeToken getParameterized
public static TypeToken<?> getParameterized(Type rawType, Type... typeArguments)
From source file:io.webfolder.cdp.session.SessionFactory.java
License:Open Source License
public List<SessionInfo> list() { String listSessions = format("http://%s:%d/json/list", host, port); URL url = null;/*from ww w .j a v a2s . c om*/ Reader reader = null; try { url = new URL(listSessions); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(connectionTimeout); reader = new InputStreamReader(conn.getInputStream()); TypeToken<?> type = TypeToken.getParameterized(List.class, SessionInfo.class); List<SessionInfo> list = gson.fromJson(reader, type.getType()); return list; } catch (IOException e) { throw new CdpException(e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // ignore } } } }