|
@@ -158,6 +158,10 @@ Type TJConv
|
|
End Rem
|
|
End Rem
|
|
Method FromJson:Object(json:String, typeName:String)
|
|
Method FromJson:Object(json:String, typeName:String)
|
|
Local typeId:TTypeId = TTypeId.ForName(typeName)
|
|
Local typeId:TTypeId = TTypeId.ForName(typeName)
|
|
|
|
+
|
|
|
|
+ If Not typeId Then
|
|
|
|
+ Throw TJconvDeserializeException.Create("Unknown type: " + typeName)
|
|
|
|
+ End If
|
|
|
|
|
|
Return FromJson(json, typeId, Null)
|
|
Return FromJson(json, typeId, Null)
|
|
End Method
|
|
End Method
|
|
@@ -171,7 +175,11 @@ Type TJConv
|
|
End If
|
|
End If
|
|
|
|
|
|
Local typeId:TTypeId = TTypeId.ForObject(obj)
|
|
Local typeId:TTypeId = TTypeId.ForObject(obj)
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ If Not typeId Then
|
|
|
|
+ Throw TJconvDeserializeException.Create("Unable to determine type from object.")
|
|
|
|
+ End If
|
|
|
|
+
|
|
Return FromJson(json, typeId, obj)
|
|
Return FromJson(json, typeId, obj)
|
|
End Method
|
|
End Method
|
|
|
|
|
|
@@ -184,7 +192,11 @@ Type TJConv
|
|
End If
|
|
End If
|
|
|
|
|
|
Local typeId:TTypeId = TTypeId.ForObject(obj)
|
|
Local typeId:TTypeId = TTypeId.ForObject(obj)
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ If Not typeId Then
|
|
|
|
+ Throw TJconvDeserializeException.Create("Unable to determine type from object.")
|
|
|
|
+ End If
|
|
|
|
+
|
|
Return FromJson(json, typeId, obj)
|
|
Return FromJson(json, typeId, obj)
|
|
End Method
|
|
End Method
|
|
|
|
|
|
@@ -194,6 +206,10 @@ Type TJConv
|
|
End Rem
|
|
End Rem
|
|
Method FromJsonInstance:Object(json:TJSON, typeName:String)
|
|
Method FromJsonInstance:Object(json:TJSON, typeName:String)
|
|
Local typeId:TTypeId = TTypeId.ForName(typeName)
|
|
Local typeId:TTypeId = TTypeId.ForName(typeName)
|
|
|
|
+
|
|
|
|
+ If Not typeId Then
|
|
|
|
+ Throw TJconvDeserializeException.Create("Unknown type: " + typeName)
|
|
|
|
+ End If
|
|
|
|
|
|
Return FromJson(json, typeId, Null)
|
|
Return FromJson(json, typeId, Null)
|
|
End Method
|
|
End Method
|
|
@@ -218,7 +234,11 @@ Type TJConv
|
|
End Rem
|
|
End Rem
|
|
Method FromJson:Object(stream:TStream, typeName:String)
|
|
Method FromJson:Object(stream:TStream, typeName:String)
|
|
Local typeId:TTypeId = TTypeId.ForName(typeName)
|
|
Local typeId:TTypeId = TTypeId.ForName(typeName)
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ If Not typeId Then
|
|
|
|
+ Throw TJconvDeserializeException.Create("Unknown type: " + typeName)
|
|
|
|
+ End If
|
|
|
|
+
|
|
Return FromJson(stream, typeId, Null)
|
|
Return FromJson(stream, typeId, Null)
|
|
End Method
|
|
End Method
|
|
|
|
|
|
@@ -235,6 +255,10 @@ Type TJConv
|
|
|
|
|
|
Method FromJson:Object(json:TJSON, typeId:TTypeId, obj:Object)
|
|
Method FromJson:Object(json:TJSON, typeId:TTypeId, obj:Object)
|
|
|
|
|
|
|
|
+ If Not typeId Then
|
|
|
|
+ Throw TJconvDeserializeException.Create("Missing typeId")
|
|
|
|
+ End If
|
|
|
|
+
|
|
Local serializer:TJConvSerializer = TJConvSerializer(options.serializers.ValueForKey(typeId.Name()))
|
|
Local serializer:TJConvSerializer = TJConvSerializer(options.serializers.ValueForKey(typeId.Name()))
|
|
If Not serializer Then
|
|
If Not serializer Then
|
|
serializer = defaultSerializer
|
|
serializer = defaultSerializer
|
|
@@ -463,6 +487,10 @@ Type TJConv
|
|
Return
|
|
Return
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
+ If Not typeId Then
|
|
|
|
+ Throw TJconvDeserializeException.Create("Missing typeId")
|
|
|
|
+ End If
|
|
|
|
+
|
|
Local dims:Int
|
|
Local dims:Int
|
|
Try
|
|
Try
|
|
dims = typeId.ArrayDimensions(array)
|
|
dims = typeId.ArrayDimensions(array)
|