* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.controller.cluster.datastore.utils;
import org.opendaylight.controller.cluster.access.concepts.MemberName;
/**
* Utils for encoding prefix shard name.
*/
-public class ClusterUtils {
+public final class ClusterUtils {
private static final Logger LOG = LoggerFactory.getLogger(ClusterUtils.class);
// id for the shard used to store prefix configuration
public static final YangInstanceIdentifier SHARD_LIST_PATH =
PREFIX_SHARDS_PATH.node(SHARD_LIST_QNAME).toOptimized();
+ private ClusterUtils() {
+ }
+
public static ShardIdentifier getShardIdentifier(final MemberName memberName, final DOMDataTreeIdentifier prefix) {
final String type;
switch (prefix.getDatastoreType()) {
builder.append(p.getNodeType().getLocalName());
if (p instanceof NodeIdentifierWithPredicates) {
builder.append("-key_");
- ((NodeIdentifierWithPredicates) p).getKeyValues().forEach((key, value) -> {
- builder.append(key.getLocalName());
- builder.append(value);
- builder.append("-");
+ ((NodeIdentifierWithPredicates) p).entrySet().forEach(entry -> {
+ builder.append(entry.getKey().getLocalName()).append(entry.getValue()).append('-');
});
- builder.append("_");
+ builder.append('_');
}
- builder.append("!");
+ builder.append('!');
});
return builder.toString();
}