File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,32 @@ implementation
207
207
System.Rtti,
208
208
PyTools.Exception;
209
209
210
+ type
211
+ // For backward compatibility
212
+ TRttiObjectHelper = class helper for TRttiObject
213
+ public
214
+ function GetAttribute (AAttrClass: TCustomAttributeClass): TCustomAttribute; overload;
215
+ function GetAttribute <T: TCustomAttribute>: T; overload; inline;
216
+ end ;
217
+
218
+ { TRttiObjectHelper }
219
+
220
+ function TRttiObjectHelper.GetAttribute (
221
+ AAttrClass: TCustomAttributeClass): TCustomAttribute;
222
+ var
223
+ LAttr: TCustomAttribute;
224
+ begin
225
+ for LAttr in GetAttributes do
226
+ if LAttr is AAttrClass then
227
+ Exit(LAttr);
228
+ Result := nil ;
229
+ end ;
230
+
231
+ function TRttiObjectHelper.GetAttribute <T>: T;
232
+ begin
233
+ Result := T(GetAttribute(T));
234
+ end ;
235
+
210
236
{ RequestChannelAttribute }
211
237
212
238
constructor RequestChannelAttribute.Create(const AIdentifier: TRequestChannelIdentifier);
You can’t perform that action at this time.
0 commit comments