Class: Quark::MdkProtocol::Serializable
Constant Summary
DatawireQuarkCore::Static::Unassigned
Class Method Summary
collapse
Instance Method Summary
collapse
_lazy_statics, static, unlazy_statics
#to_s
Constructor Details
Returns a new instance of Serializable.
48
49
50
51
52
|
# File 'lib/mdk_protocol.rb', line 48
def initialize()
self.__init_fields__
nil
end
|
Class Method Details
.decodeClassName(name, encoded) ⇒ Object
Decode JSON into a particular class. XXX TURN INTO FUNCTION
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/mdk_protocol.rb', line 60
def self.decodeClassName(name, encoded)
json = ::DatawireQuarkCore::JSONObject.parse(encoded)
clazz = ::Quark.quark.reflect.QuarkClass.get(name)
obj = ::DatawireQuarkCore.cast(clazz.construct(::DatawireQuarkCore::List.new([]))) { ::Quark.mdk_protocol.Serializable }
if ((obj) == (nil))
raise (((("could not construct ") + (clazz.getName())) + (" from this json: ")) + (encoded))
end
::Quark.quark.fromJSON(clazz, obj, json)
return obj
nil
end
|
Instance Method Details
#__init_fields__ ⇒ Object
109
110
111
112
113
|
# File 'lib/mdk_protocol.rb', line 109
def __init_fields__()
nil
end
|
#_getClass ⇒ Object
88
89
90
91
92
93
|
# File 'lib/mdk_protocol.rb', line 88
def _getClass()
return "mdk_protocol.Serializable"
nil
end
|
#_getField(name) ⇒ Object
95
96
97
98
99
100
|
# File 'lib/mdk_protocol.rb', line 95
def _getField(name)
return nil
nil
end
|
#_setField(name, value) ⇒ Object
102
103
104
105
106
107
|
# File 'lib/mdk_protocol.rb', line 102
def _setField(name, value)
nil
nil
end
|
#encode ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/mdk_protocol.rb', line 74
def encode()
clazz = ::Quark.quark.reflect.QuarkClass.get(::DatawireQuarkCore._getClass(self))
json = ::Quark.quark.toJSON(self, clazz)
jsonType = ::DatawireQuarkCore.cast((self)._getField("_json_type")) { ::String }
if ((jsonType) != (nil))
(json).setObjectItem(("type"), (::DatawireQuarkCore::JSONObject.new.setString(jsonType)))
end
encoded = json.toString()
return encoded
nil
end
|