X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2Futils%2Fserialization%2FValueType.java;h=6c884734e298a54dea541fe4973404365db41573;hb=c8e8271331ce7d3d8352f02e488ab767cbdd0631;hp=8724dfe43a2b2ba70c41b3108ac50bb2ca040994;hpb=9fa1be3b065c88dc97f7314d3a8eeb038efbabf5;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java index 8724dfe43a..6c884734e2 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java @@ -29,7 +29,8 @@ public enum ValueType { YANG_IDENTIFIER_TYPE, STRING_TYPE, BIG_INTEGER_TYPE, - BIG_DECIMAL_TYPE; + BIG_DECIMAL_TYPE, + BINARY_TYPE; private static Map types = new HashMap<>(); @@ -45,13 +46,15 @@ public enum ValueType { types.put(Short.class,SHORT_TYPE); types.put(BigInteger.class, BIG_INTEGER_TYPE); types.put(BigDecimal.class, BIG_DECIMAL_TYPE); + types.put(byte[].class, BINARY_TYPE); } public static final ValueType getSerializableType(Object node){ Preconditions.checkNotNull(node, "node should not be null"); - if(types.containsKey(node.getClass())) { - return types.get(node.getClass()); + ValueType type = types.get(node.getClass()); + if(type != null) { + return type; } else if(node instanceof Set){ return BITS_TYPE; }