List of usage examples for java.lang String toString
public String toString()
From source file:com.boozallen.cognition.ingest.storm.topology.ConfigurableIngestTopology.java
protected void configureStorm(Configuration conf, Config stormConf) throws IllegalAccessException { stormConf.registerSerialization(LogRecord.class); //stormConf.registerSerialization(Entity.class); stormConf.registerMetricsConsumer(LoggingMetricsConsumer.class); for (Iterator<String> iter = conf.getKeys(); iter.hasNext();) { String key = iter.next(); String keyString = key.toString(); String cleanedKey = keyString.replaceAll("\\.\\.", "."); String schemaFieldName = cleanedKey.replaceAll("\\.", "_").toUpperCase() + "_SCHEMA"; Field field = FieldUtils.getField(Config.class, schemaFieldName); Object fieldObject = field.get(null); if (fieldObject == Boolean.class) stormConf.put(cleanedKey, conf.getBoolean(keyString)); else if (fieldObject == String.class) stormConf.put(cleanedKey, conf.getString(keyString)); else if (fieldObject == ConfigValidation.DoubleValidator) stormConf.put(cleanedKey, conf.getDouble(keyString)); else if (fieldObject == ConfigValidation.IntegerValidator) stormConf.put(cleanedKey, conf.getInt(keyString)); else if (fieldObject == ConfigValidation.PowerOf2Validator) stormConf.put(cleanedKey, conf.getLong(keyString)); else if (fieldObject == ConfigValidation.StringOrStringListValidator) stormConf.put(cleanedKey, Arrays.asList(conf.getStringArray(keyString))); else if (fieldObject == ConfigValidation.StringsValidator) stormConf.put(cleanedKey, Arrays.asList(conf.getStringArray(keyString))); else {/*w w w .jav a2 s .co m*/ logger.error( "{} cannot be configured from XML. Consider configuring in navie storm configuration."); throw new UnsupportedOperationException(cleanedKey + " cannot be configured from XML"); } } }
From source file:com.hitachi_tstv.yodpanom.yaowaluk.tiresmanagement.CheckListActivity.java
@Override public boolean onQueryTextChange(String newText) { if (TextUtils.isEmpty(newText)) { myListView.clearTextFilter();/* w ww .j av a 2 s . co m*/ } else { myListView.setFilterText(newText.toString()); //filter.filter(newText); } return true; }
From source file:com.roncoo.pay.controller.common.BaseController2.java
public String getString_UrlDecode_GBK(String key) { try {/* w w w. ja va 2s . c o m*/ String string = getString(key.toString()); if (StringUtil.isEmpty(string)) { return null; } else { return new String(string.getBytes("GBK"), "UTF-8"); } } catch (Exception e) { log.error("??:", e); return ""; } }
From source file:com.roncoo.pay.controller.common.BaseController2.java
public String getString_UrlDecode_ISO(String key) { try {//from w w w . j a v a 2 s. c o m String string = getString(key.toString()); if (StringUtil.isEmpty(string)) { return null; } else { return new String(string.getBytes("ISO-8859-1"), "UTF-8"); } } catch (Exception e) { log.error("??:", e); return ""; } }
From source file:io.fabric8.elasticsearch.plugin.kibana.IndexMappingLoader.java
private String loadMapping(final Settings settings, final String key) { String mapping = settings.get(key); if (mapping != null && new File(mapping).exists()) { logger.info("Trying to load Kibana mapping for {} from plugin: {}", key, mapping); try {// w w w . j a v a 2 s . co m InputStream stream = new FileInputStream(mapping.toString()); return IOUtils.toString(stream); } catch (Exception e) { logger.error("Unable to load the Kibana mapping specified by {}: {}", key, e, mapping); } } throw new RuntimeException("Unable to load index mapping for " + key + ". The key was not in the settings or it specified a file that does not exists."); }
From source file:com.roncoo.pay.controller.common.BaseController2.java
/** * ????HttpRequest?String?"" .//from w ww .jav a 2 s . c o m * * @param key * . * @return String . */ public String getString_UrlDecode_UTF8(String key) { try { String string = getString(key.toString()); if (StringUtil.isEmpty(string)) { return null; } else { return URLDecoder.decode(this.getString(key), UTF_8); } } catch (Exception e) { log.error("URL?:", e); return ""; } }
From source file:de.alpharogroup.lang.ClassUtilsTest.java
@Test public void testGetManifestURL() { String actual = ClassExtensions.getManifestUrl(Object.class); AssertJUnit.assertTrue(actual.toString().startsWith("jar:file:")); AssertJUnit.assertTrue(actual.toString().endsWith("/jre/lib/rt.jar!/META-INF/MANIFEST.MF")); actual = ClassExtensions.getManifestUrl(ClassExtensions.class); AssertJUnit.assertNull(actual);// w w w.jav a 2 s.c o m }
From source file:nz.net.orcon.kanban.controllers.ViewController.java
@RequestMapping(value = "", method = RequestMethod.POST) public @ResponseBody View createView(@PathVariable String boardId, @RequestBody View view) throws Exception { if (view.getPath() != null) { logger.warn("Attempt to update template using POST"); throw new Exception("Attempt to Update Template using POST. Use PUT instead"); }//from w ww . ja v a2 s .c om ObjectContentManager ocm = ocmFactory.getOcm(); try { listTools.ensurePresence(String.format(URI.BOARD_URI, boardId), "views", ocm.getSession()); String newId = IdentifierTools.getIdFromNamedModelClass(view); view.setPath(String.format(URI.VIEW_URI, boardId, newId.toString())); ocm.insert(view); ocm.save(); this.cacheInvalidationManager.invalidate(BoardController.BOARD, boardId); } finally { ocm.logout(); } return view; }
From source file:com.qmetry.qaf.automation.ws.rest.RequestLogger.java
private void log(String b) { logger.info(b.toString()); if (loggingStream != null) { loggingStream.print(b); } }
From source file:eu.stratosphere.pact.test.pactPrograms.TPCHQuery3WithUnionITCase.java
private String[] splitInputString(String inputString, char splitChar, int noSplits) { String splitString = inputString.toString(); String[] splits = new String[noSplits]; int partitionSize = (splitString.length() / noSplits) - 2; // split data file and copy parts for (int i = 0; i < noSplits - 1; i++) { int cutPos = splitString.indexOf(splitChar, (partitionSize < splitString.length() ? partitionSize : (splitString.length() - 1))); if (cutPos != -1) { splits[i] = splitString.substring(0, cutPos) + "\n"; splitString = splitString.substring(cutPos + 1); } else {/*from w w w . j av a 2 s. c o m*/ splits[i] = ""; } } splits[noSplits - 1] = splitString; return splits; }