@Override public String toString(T value) { return Objects.toString(value); } }
private static String getContext( WatchEvent<?> watchEvent ) { return Objects.toString( watchEvent.context(), StringUtils.EMPTY ); } }
@Override public String toString() { if (!tls) { return "ConnectionSpec()"; } return "ConnectionSpec(" + "cipherSuites=" + Objects.toString(cipherSuites(), "[all enabled]") + ", tlsVersions=" + Objects.toString(tlsVersions(), "[all enabled]") + ", supportsTlsExtensions=" + supportsTlsExtensions + ")"; }
@Override @Nullable public String apply(@Nullable Object value) { return apply(Objects.toString(value, null)); }
private void appendContext(StringBuilder sb) { for (Map.Entry<String, Object> entry : context.entrySet()) { if (sb.length() > 0) { sb.append(CONTEXT_SEPARATOR); } sb.append(entry.getKey()).append("=").append(Objects.toString(entry.getValue())); } }
private void appendContext(StringBuilder sb) { for (Map.Entry<String, Object> entry : context.entrySet()) { if (sb.length() > 0) { sb.append(CONTEXT_SEPARATOR); } sb.append(entry.getKey()).append("=").append(Objects.toString(entry.getValue())); } }
/** * Set the value of a system property. * <p> * The name of the system property is computed based on the provided class and local name. * * @param location the class that owns the flag. * @param name the local name of the flag. * @param value the value to assign to the system property. */ public static void set( Class<?> location, String name, Object value ) { System.setProperty( name( location, name ), Objects.toString( value ) ); }
static String format(String pattern, Object... args) { String result = pattern; for (Object arg : args) { result = StringUtils.replaceOnce(result, "{}", Objects.toString(arg)); } return result; } }
/** * Dumps all cells of the segment into the given log */ void dump(Logger log) { for (Cell cell: getCellSet()) { log.debug(Objects.toString(cell)); } }
@Override public ProtobufSystemInfo.Section toProtobuf() { ProtobufSystemInfo.Section.Builder protobuf = ProtobufSystemInfo.Section.newBuilder(); protobuf.setName(name); Map<Object, Object> sortedProperties = new TreeMap<>(System.getProperties()); for (Map.Entry<Object, Object> systemProp : sortedProperties.entrySet()) { if (systemProp.getValue() != null) { setAttribute(protobuf, Objects.toString(systemProp.getKey()), Objects.toString(systemProp.getValue())); } } return protobuf.build(); } }
/** * Helps creating a JVM parameter for setting a feature toggle of an arbitrary type. * Given value will be converted to string using {@link Objects#toString(Object)} method. * * @param location the class that owns the flag. * @param name the local name of the flag. * @param value the value to assign to the feature toggle. * @return the parameter to pass to the command line of the forked JVM. */ public static String toggle( Class<?> location, String name, Object value ) { return toggle( name( location, name ), Objects.toString( value ) ); }
/** * @param description description of the files for logging * @param storeFiles the status of the files to log */ private void logFiles(String description, FileStatus[] storeFiles) { LOG.debug("Current " + description + ": "); for (FileStatus file : storeFiles) { LOG.debug(Objects.toString(file.getPath())); } }
@Override public void close() throws IOException { // We're done, do some final logging about it long totalTimeMillis = currentTimeMillis() - startTime; DataStatistics state = getState( DataStatistics.class ); String additionalInformation = Objects.toString( state, "Data statistics is not available." ); executionMonitor.done( successful, totalTimeMillis, format( "%n%s%nPeak memory usage: %s", additionalInformation, bytes( peakMemoryUsage ) ) ); log.info( "Import completed successfully, took " + duration( totalTimeMillis ) + ". " + additionalInformation ); closeAll( nodeRelationshipCache, nodeLabelsCache, idMapper ); }
/** Free memory by clearing unused resources after test execution. */ private void cleanUp(ITestResult testResult) { Object[] params = testResult.getParameters(); for (int i = 0; i < params.length; i++) { Object param = params[i]; if ((param instanceof AsyncLoadingCache<?, ?>) || (param instanceof Cache<?, ?>) || (param instanceof Map<?, ?>)) { params[i] = param.getClass().getSimpleName(); } else { params[i] = Objects.toString(param); } } CacheSpec.interner.remove(); } }
/** * Appends an array placing separators between each value, but * not before the first or after the last. * Appending a null array will have no effect. * Each object is appended using {@link #append(Object)}. * * @param array the array to append * @param separator the separator to use, null means no separator * @return this, to enable chaining */ public StrBuilder appendWithSeparators(final Object[] array, final String separator) { if (array != null && array.length > 0) { final String sep = Objects.toString(separator, ""); append(array[0]); for (int i = 1; i < array.length; i++) { append(sep); append(array[i]); } } return this; }
/** Free memory by clearing unused resources after test execution. */ static void cleanUp(ITestResult testResult) { Object[] params = testResult.getParameters(); for (int i = 0; i < params.length; i++) { Object param = params[i]; if ((param instanceof SingleConsumerQueue<?>)) { boolean linearizable = (((SingleConsumerQueue<?>) param).factory.apply(null) instanceof LinearizableNode<?>); params[i] = param.getClass().getSimpleName() + "_" + (linearizable ? "linearizable" : "optimistic"); } else { params[i] = Objects.toString(param); } } } }
@Override public TopNResultBuilder addEntry(DimensionAndMetricValueExtractor dimensionAndMetricValueExtractor) { Object dimensionValueObj = dimensionAndMetricValueExtractor.getDimensionValue(dimSpec.getOutputName()); String dimensionValue = Objects.toString(dimensionValueObj, null); if (shouldAdd(dimensionValue)) { pQueue.add( new DimValHolder.Builder().withDimValue(dimensionValue) .withMetricValues(dimensionAndMetricValueExtractor.getBaseObject()) .build() ); if (pQueue.size() > threshold) { pQueue.poll(); } } return this; }
protected void dumpBackupDir() throws IOException { // Dump Backup Dir FileSystem fs = FileSystem.get(conf1); RemoteIterator<LocatedFileStatus> it = fs.listFiles(new Path(BACKUP_ROOT_DIR), true); while (it.hasNext()) { LOG.debug(Objects.toString(it.next().getPath())); } } }
public FailedProcedure(long procId, String procName, User owner, NonceKey nonceKey, IOException exception) { this.procName = procName; setProcId(procId); setState(ProcedureState.ROLLEDBACK); setOwner(owner); setNonceKey(nonceKey); long currentTime = EnvironmentEdgeManager.currentTime(); setSubmittedTime(currentTime); setLastUpdate(currentTime); setFailure(Objects.toString(exception.getMessage(), ""), exception); }