We have following class:
using be.cce.SmartTools.Query.FetchDataCustomParameter.
using Consultingwerk.NativeJsonSerializable from propath.
using Consultingwerk.JsonSerializable from propath.
using be.cce.SmartTools.base.FetchCmpIdParameter from propath.
using Progress.Json.ObjectModel.JsonObject from propath.
block-level on error undo, throw.
class be.cce.SmartTools.SmartFramework.BusinessMethodParameter serializable
inherits NativeJsonSerializable:
define public serializable property MethodParameters as JsonObject no-undo
get.
set.
define public serializable property FetchCmpIdParameter as FetchCmpIdParameter no-undo
get.
set.
define public non-serializable property MethodParameterObject as JsonSerializable no-undo
get.
set.
end class.
The MethodParameterObject is JsonSerializable, but not native serializable as specific code is needed. It is in fact a class that inherits from ListQueryExpression and that implements JsonSerializable (as not the whole hierarchy of ListQueryExpression is serializable).
As far as we know there is no way to get event-like places to add custom serialization.
Then we tried following approach:
define public serializable property MethodParameterObjectSerialized as longchar no-undo
get:
if valid-object(MethodParameterObject )
then return MethodParameterObject :Serialize().
else return "".
end get.
set (input iSerialized as longchar):
define variable lCustomListQueryExpression as CustomListQueryExpression no-undo.
lCustomListQueryExpression = new CustomListQueryExpression ().
lCustomListQueryExpression:Deserialize(iSerialized).
MethodParameterObject = lFetchDataCustomParameter.
end set.
We were hoping (but knew better) that the getter and setter code would be used during the native serialization, but that doesn't seem to be the case.
So the only approach that's left is to do the serialization/deserialization at specific places in the code where this parameter object is being passed along.
Are we missing something here or does someone see another approach to accomplish this?
.
Last modified on 18 Jan 2019 16:01 by Bert Strobbe