in hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java [174:193]
public static Number sortableBytesToNumber(byte[] bytes, Class<?> clazz) {
assert NumericUtil.isNumber(clazz);
if (clazz == Long.class) {
return sortableBytesToLong(bytes);
} else if (clazz == Double.class) {
return sortableLongToDouble(sortableBytesToLong(bytes));
} else if (clazz == Float.class) {
return sortableIntToFloat(sortableBytesToInt(bytes));
} else if (clazz == Integer.class) {
return sortableBytesToInt(bytes);
} else if (clazz == Short.class) {
return (short) sortableBytesToInt(bytes);
} else if (clazz == Byte.class) {
return sortableBytesToByte(bytes);
}
// TODO: support other number types
throw unsupportedNumberType(clazz);
}