def _convert_java_value(kv, include_non_primitives=True): try: pobj = javaobj.loads(kv.serialized_value) if pyutils.is_str_instance(pobj): return pobj if pobj.is_primitive(): return pobj.value if include_non_primitives: # java objects that are not strings return value and encoded value # Hexadecimal byte array for Serialized objects that return { 'value': json.dumps(pobj, default=lambda custom_field: custom_field.__dict__, sort_keys=True, indent=2), 'raw': utils.hex_escape(kv.serialized_value) } return None except Exception: Log.exception("Failed to parse data as java object") if include_non_primitives: return _raw_value(kv) else: return None
def _convert_java_value(kv, include_non_primitives=True): try: pobj = javaobj.loads(kv.serialized_value) if pyutils.is_str_instance(pobj): return pobj if pobj.is_primitive(): return pobj.value if include_non_primitives: # java objects that are not strings return value and encoded value # Hexadecimal byte array for Serialized objects that return { 'value' : json.dumps(pobj, default=lambda custom_field: custom_field.__dict__, sort_keys=True, indent=2), 'raw' : utils.hex_escape(kv.serialized_value)} return None except Exception: Log.exception("Failed to parse data as java object") if include_non_primitives: return _raw_value(kv) else: return None