Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 177 lines (124 sloc) 6.394 kb
0b13b0c @trung created helper to generate record_utils dynamically for records
authored
1 %% This is auto generated file. Please don't edit it
2
6ab3d15 @trung amf3 read complete
authored
3 -module(record_utils).
4 -author("trung@mdkt.org").
5 -compile(export_all).
5ae03f2 @trung restructure include files
authored
6 -include("../include/messages.hrl").
0b13b0c @trung created helper to generate record_utils dynamically for records
authored
7 -include("../include/types.hrl").
8
9 fields(abstract_message) ->
10 ["clientId", "destination", "messageId", "timestamp", "timeToLive", "headers", "body"];
11
12 fields(async_message) ->
13 ["parent", "correlationId", "correlationIdBytes"];
14
15 fields(command_message) ->
16 ["parent", "operation"];
17
18 fields(remoting_message) ->
19 ["parent", "source", "operation", "parameters"];
20
21 fields(rpc_message) ->
22 ["parent", "remoteUsername", "remotePassword"].
23
24 fields_atom(abstract_message) ->
25 [clientId, destination, messageId, timestamp, timeToLive, headers, body];
26
27 fields_atom(async_message) ->
28 [parent, correlationId, correlationIdBytes];
29
30 fields_atom(command_message) ->
31 [parent, operation];
32
33 fields_atom(remoting_message) ->
34 [parent, source, operation, parameters];
35
36 fields_atom(rpc_message) ->
37 [parent, remoteUsername, remotePassword].
38
39 set(Obj, body, Value) when is_record(Obj, abstract_message) ->
40 NewObj = Obj#abstract_message{body = Value},
41 {ok, NewObj, {body, Value}};
42
43 set(Obj, clientId, Value) when is_record(Obj, abstract_message) ->
44 NewObj = Obj#abstract_message{clientId = Value},
45 {ok, NewObj, {clientId, Value}};
46
47 set(Obj, destination, Value) when is_record(Obj, abstract_message) ->
48 NewObj = Obj#abstract_message{destination = Value},
49 {ok, NewObj, {destination, Value}};
50
51 set(Obj, headers, Value) when is_record(Obj, abstract_message) ->
52 NewObj = Obj#abstract_message{headers = Value},
53 {ok, NewObj, {headers, Value}};
54
55 set(Obj, messageId, Value) when is_record(Obj, abstract_message) ->
56 NewObj = Obj#abstract_message{messageId = Value},
57 {ok, NewObj, {messageId, Value}};
58
59 set(Obj, timeToLive, Value) when is_record(Obj, abstract_message) ->
60 NewObj = Obj#abstract_message{timeToLive = Value},
61 {ok, NewObj, {timeToLive, Value}};
62
63 set(Obj, timestamp, Value) when is_record(Obj, abstract_message) ->
64 NewObj = Obj#abstract_message{timestamp = Value},
65 {ok, NewObj, {timestamp, Value}};
66
67 set(Obj, PropertyName, Value) when is_record(Obj, asobject) ->
68 NewObj = #asobject{array = Obj#asobject.array ++ [{PropertyName, Value}]},
69 {ok, NewObj, {array, Value}};
70
71 set(Obj, correlationId, Value) when is_record(Obj, async_message) ->
72 NewObj = Obj#async_message{correlationId = Value},
73 {ok, NewObj, {correlationId, Value}};
74
75 set(Obj, correlationIdBytes, Value) when is_record(Obj, async_message) ->
76 NewObj = Obj#async_message{correlationIdBytes = Value},
77 {ok, NewObj, {correlationIdBytes, Value}};
78
79 set(Obj, parent, Value) when is_record(Obj, async_message) and is_record(Value, abstract_message) ->
80 NewObj = Obj#async_message{parent = Value},
81 {ok, NewObj, {parent, Value}};
82
83 set(Obj, ParentProperty, Value) when is_record(Obj, async_message) and is_atom(ParentProperty) ->
84 {ok, NewParentObject, _} = set(Obj#async_message.parent, ParentProperty, Value),
85 set(Obj, parent, NewParentObject);
86
87 set(Obj, operation, Value) when is_record(Obj, command_message) ->
88 NewObj = Obj#command_message{operation = Value},
89 {ok, NewObj, {operation, Value}};
90
91 set(Obj, parent, Value) when is_record(Obj, command_message) and is_record(Value, async_message) ->
92 NewObj = Obj#command_message{parent = Value},
93 {ok, NewObj, {parent, Value}};
94
95 set(Obj, ParentProperty, Value) when is_record(Obj, command_message) and is_atom(ParentProperty) ->
96 {ok, NewParentObject, _} = set(Obj#command_message.parent, ParentProperty, Value),
97 set(Obj, parent, NewParentObject);
98
99 set(Obj, data, Value) when is_record(Obj, ecma_array) ->
100 NewObj = Obj#ecma_array{data = Value},
101 {ok, NewObj, {data, Value}};
102
103 set(Obj, data, Value) when is_record(Obj, long_string) ->
104 NewObj = Obj#long_string{data = Value},
105 {ok, NewObj, {data, Value}};
106
107 set(Obj, operation, Value) when is_record(Obj, remoting_message) ->
108 NewObj = Obj#remoting_message{operation = Value},
109 {ok, NewObj, {operation, Value}};
110
111 set(Obj, parameters, Value) when is_record(Obj, remoting_message) ->
112 NewObj = Obj#remoting_message{parameters = Value},
113 {ok, NewObj, {parameters, Value}};
114
115 set(Obj, source, Value) when is_record(Obj, remoting_message) ->
116 NewObj = Obj#remoting_message{source = Value},
117 {ok, NewObj, {source, Value}};
118
119 set(Obj, parent, Value) when is_record(Obj, remoting_message) and is_record(Value, rpc_message) ->
120 NewObj = Obj#remoting_message{parent = Value},
121 {ok, NewObj, {parent, Value}};
122
123 set(Obj, ParentProperty, Value) when is_record(Obj, remoting_message) and is_atom(ParentProperty) ->
124 {ok, NewParentObject, _} = set(Obj#remoting_message.parent, ParentProperty, Value),
125 set(Obj, parent, NewParentObject);
126
127 set(Obj, remotePassword, Value) when is_record(Obj, rpc_message) ->
128 NewObj = Obj#rpc_message{remotePassword = Value},
129 {ok, NewObj, {remotePassword, Value}};
130
131 set(Obj, remoteUsername, Value) when is_record(Obj, rpc_message) ->
132 NewObj = Obj#rpc_message{remoteUsername = Value},
133 {ok, NewObj, {remoteUsername, Value}};
134
135 set(Obj, parent, Value) when is_record(Obj, rpc_message) and is_record(Value, abstract_message) ->
136 NewObj = Obj#rpc_message{parent = Value},
137 {ok, NewObj, {parent, Value}};
138
139 set(Obj, ParentProperty, Value) when is_record(Obj, rpc_message) and is_atom(ParentProperty) ->
140 {ok, NewParentObject, _} = set(Obj#rpc_message.parent, ParentProperty, Value),
141 set(Obj, parent, NewParentObject);
142
143 set(Obj, data, Value) when is_record(Obj, string) ->
144 NewObj = Obj#string{data = Value},
145 {ok, NewObj, {data, Value}};
146
147 set(Obj, data, Value) when is_record(Obj, string_3) ->
148 NewObj = Obj#string_3{data = Value},
149 {ok, NewObj, {data, Value}};
150
151 set(Obj, data, Value) when is_record(Obj, xml) ->
152 NewObj = Obj#xml{data = Value},
153 {ok, NewObj, {data, Value}}.
154
155 type(Obj) when is_record(Obj, abstract_message) -> abstract_message;
156
157 type(Obj) when is_record(Obj, asobject) -> asobject;
158
159 type(Obj) when is_record(Obj, async_message) -> async_message;
160
161 type(Obj) when is_record(Obj, command_message) -> command_message;
162
163 type(Obj) when is_record(Obj, ecma_array) -> ecma_array;
164
165 type(Obj) when is_record(Obj, long_string) -> long_string;
166
167 type(Obj) when is_record(Obj, remoting_message) -> remoting_message;
168
169 type(Obj) when is_record(Obj, rpc_message) -> rpc_message;
170
171 type(Obj) when is_record(Obj, string) -> string;
172
173 type(Obj) when is_record(Obj, string_3) -> string_3;
174
175 type(Obj) when is_record(Obj, xml) -> xml.
176
Something went wrong with that request. Please try again.