List of usage examples for java.util Objects toString
public static String toString(Object o)
From source file:org.codice.ddf.catalog.ui.forms.model.FilterNodeMapImpl.java
@Override @Nullable//from w w w .j a va 2 s .c o m public String getValue() { if (!isLeaf()) { throw new IllegalStateException("No target value exists for a logical operator"); } return Objects.toString(json.get(VALUE)); }
From source file:org.kitodo.production.forms.dataeditor.TextMetadataTableRow.java
@Override public void validatorQuery(FacesContext context, UIComponent component, Object value) { if (!settings.isValid(Objects.toString(value))) { String message = Helper.getTranslation("dataEditor.invalidMetadataValue", Arrays.asList(settings.getLabel(), Objects.toString(value))); FacesMessage facesMessage = new FacesMessage(message, message); facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(facesMessage); }//from w w w . j a v a2 s .co m }
From source file:org.openhab.action.ciscospark.internal.CiscoSparkActionService.java
/** * @{inheritDoc}//from w w w . j a v a 2 s . c om */ @Override public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String accessTokenString = Objects.toString(config.get("accessToken")); if (isNotBlank(accessTokenString)) { accessToken = accessTokenString; } if (isBlank(accessToken)) { throw new ConfigurationException("ciscospark", "The parameter 'accessToken' is missing! Please refer to your config file."); } String defaultRoomIdString = Objects.toString(config.get("defaultRoomId")); if (isNotBlank(defaultRoomIdString)) { defaultRoomId = defaultRoomIdString; } isProperlyConfigured = true; start(); } }
From source file:com.opentable.exception.ExceptionClientResponseFilter.java
private OTApiException toException(final Map<String, Object> fields) { final String type = Objects.toString(fields.get(OTApiException.ERROR_TYPE)); final Set<ExceptionReviver> set = revivers.get(type); if (set.isEmpty()) { LOG.error("Unknown exception type '{}'", type); return makeUnknownException(fields); }//from w w w. ja v a 2 s .c o m for (final ExceptionReviver er : set) { final OTApiException ex = er.apply(fields); if (ex != null) { return ex; } } LOG.error("No registered handler handled {}", fields); return makeUnknownException(fields); }
From source file:io.tsdb.opentsdb.realtime.RollupPublisher.java
private void storeDatapoint(final IncomingDataPoint dp) { long ts = floorTimestamp(new Date(dp.getTimestamp()), this.minutes).getTime(); String tagString = getTagString(new HashMap<String, String>(dp.getTags())); String key = DigestUtils.md5Hex(dp.getMetric() + Objects.toString(ts) + tagString); LOG.trace("Key evaluates to: " + key); if (!this.dataPointsMap.containsKey(key)) { LOG.trace("adding new dps key, timestamp: " + ts); this.dataPointsMap.put(key, new DataPoints(ts, dp)); } else {/* www . j a v a 2 s. c o m*/ LOG.trace("adding to existing dps, timestamp: " + ts); DataPoints dps = this.dataPointsMap.get(key); dps.addDatapoint(dp); this.dataPointsMap.replace(key, dps); } }
From source file:com.nesscomputing.jersey.wadl.NessWadlAnnotator.java
/** * Return the annotation's <code>value()</code> as a String if present, else * the literal "true"./* www . ja v a2 s .c o m*/ */ private String annotationStringValue(Annotation a) { java.lang.reflect.Method valueMethod = null; try { valueMethod = a.annotationType().getMethod("value", new Class[0]); } catch (NoSuchMethodException e) { LOG.trace("No value method on %s, just using \"true\"", a.annotationType()); } if (valueMethod != null) { Object result; try { result = valueMethod.invoke(a); } catch (IllegalAccessException | InvocationTargetException e) { throw Throwables.propagate(e); } if (result.getClass().isArray()) { return ArrayUtils.toString(result); } return Objects.toString(result); } return "true"; }
From source file:net.dv8tion.jda.core.requests.Response.java
public String getString() { return Objects.toString(object); }
From source file:net.minecraftforge.common.util.TextTable.java
public void add(@Nonnull Object... values) { if (values.length != columns.size()) { throw new IllegalArgumentException("Received wrong amount of values for table row, expected " + columns.size() + ", received " + columns.size() + "."); }/*from w w w.ja va 2s . c o m*/ Row row = new Row(); for (int i = 0; i < values.length; i++) { String value = Objects.toString(values[i]); row.values.add(value); columns.get(i).fit(value); } rows.add(row); }
From source file:de.knightsoftnet.mtwidgets.client.ui.widget.AbstractPhoneNumberRestSuggestBox.java
@Override public void formatValue(final ValueWithPos<String> pvalue) { if (pvalue == null || StringUtils.isEmpty(pvalue.getValue())) { this.setValue(StringUtils.EMPTY); } else {// w ww . j a v a2 s . com final ValueWithPosAndCountry<String> unformatedEntry = new ValueWithPosAndCountry<String>( pvalue.getValue(), pvalue.getPos(), Objects.toString(this.countryCodeField.getValue()), LocaleInfo.getCurrentLocale().getLocaleName()); try { final FutureResult<ValueWithPos<String>> result = this.cache.get(unformatedEntry); if (result.isDone()) { this.setTextWithPos(result.get()); } } catch (final ExecutionException e) { GWT.log(e.getMessage(), e); } } }
From source file:de.jfachwert.bank.GeldbetragFormatter.java
/** * Wandelt im Wesentlichen den uebergebenen Geldbetrag in seine String- * Darstellung um.//w ww. j a va2s .c o m * * @param amount Geldbetrag * @return Geldbetrag als String */ @Override public String queryFrom(MonetaryAmount amount) { return Objects.toString(amount); }