Java Code Examples for com.google.common.base.Joiner#MapJoiner
The following examples show how to use
com.google.common.base.Joiner#MapJoiner .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReplicationMetaData.java From incubator-gobblin with Apache License 2.0 | 4 votes |
@Override public String toString() { Joiner.MapJoiner mapJoiner = Joiner.on(',').withKeyValueSeparator("="); return Objects.toStringHelper(this.getClass()).add("metadata", mapJoiner.join(this.values.get())).toString(); }
Example 2
Source File: FBUtilities.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public static String toString(Map<?,?> map) { Joiner.MapJoiner joiner = Joiner.on(", ").withKeyValueSeparator(":"); return joiner.join(map); }
Example 3
Source File: ElementUtils.java From antiquity with GNU General Public License v3.0 | 3 votes |
/** * <p> * 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(); }