List of usage examples for org.apache.commons.lang ObjectUtils toString
public static String toString(Object obj)
Gets the toString
of an Object
returning an empty string ("") if null
input.
ObjectUtils.toString(null) = "" ObjectUtils.toString("") = "" ObjectUtils.toString("bat") = "bat" ObjectUtils.toString(Boolean.TRUE) = "true"
From source file:com.dattack.naming.StandaloneJndiTest.java
@Ignore("Validate the response against the JNDI specification") @Test// w w w.j av a 2 s .c o m public void testBindInvalidContext() throws NamingException { exception.expect(NamingException.class); final InitialContext context = new InitialContext(); final String name = getCompositeName(INVALID_CONTEXT, "testBind"); final Object obj = new Integer(10); context.bind(name, obj); fail(String.format("This test must fail because the name '%s' not exists (object: %s)", INVALID_CONTEXT, ObjectUtils.toString(obj))); }
From source file:jp.primecloud.auto.common.component.FreeMarkerGenerator.java
protected Map<String, Object> copyMap(Map<String, Object> map) { Map<String, Object> copyMap = new HashMap<String, Object>(map); // ?/* w ww . j a v a2 s . c om*/ Map<String, String> entries = new HashMap<String, String>(); for (Entry<String, Object> entry : map.entrySet()) { entries.put(entry.getKey(), ObjectUtils.toString(entry.getValue())); } copyMap.put("entries", entries); return copyMap; }
From source file:de.codesourcery.eve.skills.ui.config.DefaultAppConfigProvider.java
@Override public void appConfigChanged(final String... properties) { log.info("appConfigChanged(): Config(s) changed: " + ObjectUtils.toString(properties)); List<IAppConfigChangeListener> copy; synchronized (listeners) { copy = new ArrayList<IAppConfigChangeListener>(listeners); }//from ww w . j a v a 2 s.co m for (IAppConfigChangeListener l : copy) { try { l.appConfigChanged(getAppConfig(), properties); } catch (Exception e) { log.error("appConfigChanged(): Listener " + l + " threw exception", e); } } }
From source file:br.com.autonomiccs.autonomic.plugin.common.daos.HostJdbcDao.java
/** * Updates the 'administration_status' column from the 'host' table. *///from w w w . j a v a 2 s . c o m public void setAdministrationStatus(HostAdministrationStatus hostAdministrationStatus, long hostId) { Object[] args = { ObjectUtils.toString(hostAdministrationStatus), hostId }; getJdbcTemplate().update(sqlSetAdministrationStatus, args); }
From source file:mitm.djigzo.web.common.GenericSelectionModel.java
@Override public List<OptionModel> getOptions() { List<OptionModel> optionModelList = new ArrayList<OptionModel>(); for (T obj : collection) { if (labelFieldAdapter == null) { optionModelList.add(new OptionModelImpl(ObjectUtils.toString(obj) + "", obj)); } else {/*w w w. j av a 2 s .c om*/ optionModelList.add(new OptionModelImpl(ObjectUtils.toString(labelFieldAdapter.get(obj)), obj)); } } return optionModelList; }
From source file:com.manydesigns.elements.configuration.BeanLookup.java
@Override public String lookup(String key) { try {/*from w w w .j a va 2 s .c om*/ PropertyAccessor property = accessor.getProperty(key); return ObjectUtils.toString(property.get(bean)); } catch (NoSuchFieldException e) { logger.warn("Cannot access property '{}' on class '{}'", key, accessor.getName()); return null; } }
From source file:hudson.plugins.plot.CSVSeries.java
public String getInclusionFlag() { return ObjectUtils.toString(inclusionFlag); }
From source file:com.boozallen.cognition.ingest.storm.bolt.starter.FlattenJsonBolt.java
void parseJson(String jsonString, LogRecord logRecord) { String cleanedJsonString = IngestUtilities.removeUnprintableCharacters(jsonString); Config cfg = ConfigFactory.parseString(cleanedJsonString); for (Map.Entry<String, ConfigValue> entry : cfg.entrySet()) { String key = entry.getKey(); ConfigValue value = entry.getValue(); switch (value.valueType()) { case BOOLEAN: case NUMBER: case OBJECT: case STRING: logRecord.setValue(key, ObjectUtils.toString(value.unwrapped())); break; case LIST: ConfigList list = (ConfigList) value; Gson gson = new Gson(); String json = gson.toJson(list.unwrapped()); logRecord.setValue(key, json); break; case NULL: default:/*from ww w . j a v a 2 s.c o m*/ // skip } } }
From source file:mitm.application.djigzo.james.mailets.FilterSubject.java
private String[] getFilter(Mail mail) { /*// w ww . j a va2s .co m * Use #toString on the attribute value */ String regExpValue = attribute != null ? ObjectUtils.toString(mail.getAttribute(attribute)) : filter; String[] result = RegExprUtils.splitRegExp(regExpValue); if (regExpValue != null && result == null) { logger.warn("Filter {} is not a valid filter", regExpValue); } return result; }
From source file:com.alibaba.otter.shared.common.utils.cache.RefreshMemoryMirror.java
/** * ?key String//from w w w .j av a 2 s . co m * * @param key * @return */ private String getKey(Object key) { if (key == null) { throw new IllegalArgumentException("Cache key not be null"); } return ObjectUtils.toString(key); }