List of usage examples for com.google.common.base Joiner.MapJoiner join
@CheckReturnValue public final String join(Object[] parts)
From source file:net.ftb.util.AppUtils.java
public static String MapListToString(Map<String, List<String>> l) { Joiner.MapJoiner mapJoiner = Joiner.on('\n').withKeyValueSeparator("=").useForNull("NULL"); return mapJoiner.join(l); }
From source file:com.vertixtech.antiquity.graph.ElementUtils.java
/** * <p>/*from www . ja va2 s . co m*/ * Calculate the private hash of an {@link Element}. * </p> * * <p> * The private hash contains only the properties of the {@link Element}, without its associated elements. * </p> * * <p> * The hash is calculated based on SHA1 algorithm * </p> * * TODO Handle arrays values properly. * * @param element * The element to calculate the private hash for. * @param excludedKeys * the keys to exclude when hash is calculated. * @return A string representation of the hash * @see HashCode#toString() */ public static String calculateElementPrivateHash(Element element, Set<String> excludedKeys) { Map<String, Object> props = ElementUtils.getPropertiesAsMap(element, excludedKeys); Joiner.MapJoiner propsJoiner = Joiner.on('&').withKeyValueSeparator("="); HashFunction hf = Hashing.sha1(); Hasher h = hf.newHasher(); h.putString("[" + element.getId().toString() + "]"); h.putString(propsJoiner.join(props)); return h.hash().toString(); }
From source file:co.indexia.antiquity.graph.ElementUtils.java
/** * <p>/*from w w w . j a va2s . c om*/ * Calculate the private hash of an {@link Element}. * </p> * * <p> * The private hash contains only the properties of the {@link Element}, * without its associated elements. * </p> * * <p> * The hash is calculated based on SHA1 algorithm * </p> * * TODO Handle arrays values properly. * * @param element The element to calculate the private hash for. * @param excludedKeys the keys to exclude when hash is calculated. * @return A string representation of the hash * @see HashCode#toString() */ public static String calculateElementPrivateHash(Element element, Set<String> excludedKeys) { Map<String, Object> props = ElementUtils.getPropertiesAsMap(element, excludedKeys); Joiner.MapJoiner propsJoiner = Joiner.on('&').withKeyValueSeparator("="); HashFunction hf = Hashing.sha1(); Hasher h = hf.newHasher(); //h.putString("[" + element.getId().toString() + "]"); h.putString(propsJoiner.join(props), Charset.defaultCharset()); return h.hash().toString(); }
From source file:org.apache.cassandra.utils.FBUtilities.java
public static String toString(Map<?, ?> map) { Joiner.MapJoiner joiner = Joiner.on(", ").withKeyValueSeparator(":"); return joiner.join(map); }
From source file:org.elasticsearch.plugin.readonlyrest.acl.BlockHistory.java
@Override public String toString() { Map<String, Boolean> rule2result = Maps.newHashMap(); for (RuleExitResult rer : results) { rule2result.put(rer.getCondition().getKey(), rer.isMatch()); }//from ww w . j av a 2 s . c om Joiner.MapJoiner j = Joiner.on(", ").withKeyValueSeparator("->"); return "[" + name + "->[" + j.join(rule2result) + "]]"; }
From source file:tech.beshu.ror.acl.BlockHistory.java
public String toString() { Map<String, Boolean> rule2result = Maps.newHashMap(); for (RuleExitResult rer : results) { rule2result.put(rer.getCondition().getKey(), rer.isMatch()); }// ww w . j ava 2 s. c o m Joiner.MapJoiner j = Joiner.on(", ").withKeyValueSeparator("->"); return "[" + name + "->[" + j.join(rule2result) + "]]"; }
From source file:org.apache.tez.log.analyzer.FailedTaskAnalyzer.java
@Override public String getAnalysis() throws IOException { Joiner.MapJoiner joiner = Joiner.on('\n').withKeyValueSeparator("="); return joiner.join(failedTaskMap); }
From source file:org.apache.tez.log.analyzer.StuckTaskAnalyzer.java
@Override public String getAnalysis() throws IOException { Map<String, String> diffMap = Maps.newLinkedHashMap(); for (Map.Entry<String, String> entry : startedTasks.entrySet()) { if (finishedTasks.get(entry.getKey()) == null) { diffMap.put(entry.getKey(), entry.getValue()); }//from w w w . j av a 2s . c om } Joiner.MapJoiner joiner = Joiner.on('\n').withKeyValueSeparator("="); return joiner.join(diffMap); }
From source file:org.apache.tez.log.analyzer.TaskAttemptStartedAnalyzer.java
@Override public String getAnalysis() throws IOException { Joiner.MapJoiner joiner = Joiner.on('\n').withKeyValueSeparator("="); return joiner.join(taskAttemptStartedMap); }
From source file:org.apache.tez.log.analyzer.SplitsAnalyzer.java
@Override public String getAnalysis() throws IOException { Joiner.MapJoiner joiner = Joiner.on('\n').withKeyValueSeparator("="); return joiner.join(splitsMap) + Joiner.on('\n').join(debugList); }