RTTI enables you to easily retrieve details on
the methods, fields and properties of a class.
TRttiType =
class(TRttiNamedObject)
public
function GetMethods: TArray<TRttiMethod>; overload;
virtual;
function GetFields: TArray<TRttiField>; virtual;
function GetProperties: TArray<TRttiProperty>;
virtual;
It provides methods to easily get or set the
value of a field.
TRttiField =
class(TRttiMember)
public
property FieldType: TRttiType read GetFieldType;
function GetValue(Instance: Pointer): TValue; virtual;
procedure SetValue(Instance: Pointer; const AValue: TValue);
virtual;
Information on class methods including their
return types and parameters can be easily discovered. Invoking the
method is also made easy.
TRttiMethod =
class(TRttiMember)
public
function Invoke(Instance: TObject; const Args: array of
TValue): TValue; overload;
function GetParameters: TArray<TRttiParameter>;
virtual; abstract;
property ReturnType: TRttiType read GetReturnType;
property IsConstructor: Boolean read GetIsConstructor;
property IsDestructor: Boolean read
GetIsDestructor;