List of usage examples for java.util Map toString
public String toString()
From source file:org.oncoblocks.centromere.dataimport.cli.DataImportManager.java
/** * Builds the {@code dataTypeMap} by inspecting registered {@link RecordProcessor} beans and their * {@link DataTypes} annotations./*from w w w. j a v a 2 s .co m*/ */ private Map<String, RecordProcessor> initializeDataTypeMap() { logger.debug("[CENTROMERE] Initializing DataImportManager data type mappings."); Map<String, RecordProcessor> map = new HashMap<>(); for (Map.Entry entry : applicationContext.getBeansWithAnnotation(DataTypes.class).entrySet()) { Object obj = entry.getValue(); if (obj instanceof RecordProcessor) { RecordProcessor p = (RecordProcessor) obj; DataTypes dataTypes = p.getClass().getAnnotation(DataTypes.class); for (String t : dataTypes.value()) { map.put(t, p); } } } logger.debug(String.format("[CENTROMERE] Data type map initialized: %s", map.toString())); return map; }
From source file:oculus.aperture.capture.phantom.impl.PhantomRenderer.java
private void evaluateMessageSize(Map<String, Object> task) throws InterruptedException { if (task == null || (task.containsKey("reconnect") && (Boolean) task.get("reconnect"))) { messageSize = 0;//ww w. ja v a 2s . co m return; } int newMessageSize; try { byte[] utf8Bytes = new JSONObject(task).toString().getBytes("UTF-8"); newMessageSize = utf8Bytes.length; } catch (UnsupportedEncodingException e) { newMessageSize = task.toString().length(); } messageSize += newMessageSize; if (messageSize > MAX_MESSAGE_SIZE) { resetMessage = true; } }
From source file:com.urgoo.message.activities.MainActivity.java
/** * ??//from ww w .j a v a 2 s . c o m */ private void approveDev() { Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); Map responseMap = (Map) msg.obj; android.util.Log.e("responseMap:", responseMap.toString()); getUserIDs(); } }; String random = "123456"; HRSDK.approveDev("AFC90B23F5C533130EAC39713D1740BC", random, handler); }
From source file:com.stepsdk.android.api.APIClient.java
public void post(final String address, final Map<String, String> params, final Map<String, String> files, final APIRequestHandler handler) { log(TAG, "POST: " + address + "(" + params.toString() + ")"); new AsyncTask<Void, Void, Void>() { private boolean mInterrupt = false; @Override//w w w. j a va 2s .c om protected void onPreExecute() { handler.before(); }; @Override protected Void doInBackground(Void... nothing) { Integer retryRemaining = 3; while (retryRemaining > 0) { try { if (!NetworkUtil.isOnline(mContext)) { handler.onException(new NetworkDownException()); return null; } HttpEntity response = null; if (files == null || files.size() == 0) response = postRequest(address, params); else response = postRequest(address, params, files); handler.onResponse(response); break; } catch (ClientProtocolException e) { if (retryRemaining-- < 0) { handler.onException(e); } } catch (IOException e) { if (retryRemaining-- < 0) { handler.onException(e); } } catch (NetworkDownException e) { if (retryRemaining-- < 0) { handler.onException(e); } } catch (HttpGetException e) { if (retryRemaining-- < 0) { handler.onException(e); } } catch (Exception e) { if (retryRemaining-- < 0) { handler.onException(e); } } } return null; }; @Override protected void onPostExecute(Void result) { if (!mInterrupt) handler.after(); }; }.execute(); }
From source file:com.almende.eve.transport.xmpp.XmppService.java
@Override public String toString() { final Map<String, Object> data = new HashMap<String, Object>(); data.put("class", this.getClass().getName()); data.put("host", host); data.put("port", port); data.put("service", service); data.put("protocols", protocols); return data.toString(); }
From source file:CookieVideoView.java
private Map<String, String> getCookieHeader() { String hostDomain = mUri.getHost(); List<Cookie> cookieList = new PersistentCookieStore(mContext).getCookies(); for (Cookie cookie : cookieList) { if (cookie.getDomain().equalsIgnoreCase(hostDomain)) { Map<String, String> header = new HashMap<String, String>(); header.put("Cookie", cookie.getName() + "=" + cookie.getValue()); Log.d(TAG, "Cookie: " + header.toString()); return header; }//from w w w .j a v a 2 s . c o m } return null; }
From source file:com.prey.net.PreyRestHttpClient.java
public PreyHttpResponse post(String url, Map<String, String> params) throws IOException { HttpPost method = new HttpPost(url); method.setHeader("Accept", "*/*"); method.setEntity(new UrlEncodedFormEntity(getHttpParamsFromMap(params), HTTP.UTF_8)); // method.setParams(getHttpParamsFromMap(params)); PreyLogger.d("Sending using 'POST' - URI: " + url + " - parameters: " + params.toString()); httpclient.setRedirectHandler(new NotRedirectHandler()); HttpResponse httpResponse = httpclient.execute(method); PreyHttpResponse response = new PreyHttpResponse(httpResponse); //PreyLogger.d("Response from server: " + response.toString()); return response; }
From source file:org.apache.usergrid.java.client.model.UsergridEntity.java
public void updatePropertiesWithMap(@NotNull final Map<String, ?> properties) { try {/*from ww w .j a v a 2 s . c om*/ this.updatePropertiesWithJsonNode(entityUpdateMapper.valueToTree(properties)); } catch (IllegalArgumentException e) { System.out.print("Usergrid Error: Unable to update properties from map - " + properties.toString()); } }
From source file:org.codelabor.system.file.web.servlet.FileUploadServlet.java
/** * ? ?? .</br>? ??/*w w w .j a va 2 s . co m*/ * org.codelabor.system.file.FileConstants.FILE_LIST_KEY? attribute? * ??. Map Id? ? Map Id * org.codelabor.system.file.FileConstants.MAP_ID? attribute? ??. * * @param request * * @param response * ? * @throws Exception * */ protected void list(HttpServletRequest request, HttpServletResponse response) throws Exception { WebApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); FileManager fileManager = (FileManager) ctx.getBean("fileManager"); Map<String, Object> paramMap = RequestUtils.getParameterMap(request); logger.debug("paramMap: {}", paramMap.toString()); String mapId = (String) paramMap.get("mapId"); String repositoryType = (String) paramMap.get("repositoryType"); IdGenService mapIdGenService = (IdGenService) ctx.getBean("sequenceMapIdGenService"); List<FileDTO> fileDTOList = null; try { if (StringUtils.isEmpty(repositoryType)) { if (StringUtils.isEmpty(mapId)) { fileDTOList = fileManager.selectFileAll(); } else { fileDTOList = fileManager.selectFileByMapId(mapId); } } else { switch (RepositoryType.valueOf(repositoryType)) { case DATABASE: fileDTOList = fileManager.selectFileByRepositoryType(RepositoryType.DATABASE); break; case FILE_SYSTEM: fileDTOList = fileManager.selectFileByRepositoryType(RepositoryType.FILE_SYSTEM); break; default: logger.error("Invalid repository type: {}", repositoryType); throw new InvalidRepositoryTypeException(repositoryType); } } request.setAttribute(org.codelabor.system.file.FileConstants.FILE_LIST_KEY, fileDTOList); request.setAttribute(org.codelabor.system.file.FileConstants.MAP_ID, mapIdGenService.getNextStringId()); } catch (Exception e) { e.printStackTrace(); logger.error(e.getMessage()); } dispatch(request, response, forwardPathList); }
From source file:org.logicblaze.lingo.cache.impl.ThreadCache.java
public String toString() { Map map = (clear) ? new IdentityHashMap() : new IdentityHashMap(backingCache); for (Iterator iter = localRemoves.keySet().iterator(); iter.hasNext();) { map.remove(iter.next());//from w w w . j a v a 2s . c om } for (Iterator iter = localChanges.entrySet().iterator(); iter.hasNext();) { Entry entry = (Entry) iter.next(); Object key = entry.getKey(); VersionedValue change = (VersionedValue) entry.getValue(); map.put(key, change.getValue()); } return map.toString(); }