Binding
This commit is contained in:
@@ -15,7 +15,7 @@ type
|
||||
class function TypeToScalarKind(AType: TRttiType): TScalarKind; static;
|
||||
public
|
||||
// Creates a JSON definition string from a record type info.
|
||||
class function RecordDefinitionToJson(ATypeInfo: PTypeInfo): string; static;
|
||||
class function RecordDefinitionToJson<T: record>: string; static;
|
||||
// Creates a record definition from a JSON string.
|
||||
class function JsonToRecordDefinition(const AJson: string): TScalarRecordDefinition; static;
|
||||
end;
|
||||
@@ -67,7 +67,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TRttiAstHelper.RecordDefinitionToJson(ATypeInfo: PTypeInfo): string;
|
||||
class function TRttiAstHelper.RecordDefinitionToJson<T>: string;
|
||||
var
|
||||
ctx: TRttiContext;
|
||||
rttiType: TRttiType;
|
||||
@@ -77,7 +77,7 @@ var
|
||||
fieldObj: TJSONObject;
|
||||
begin
|
||||
ctx := TRttiContext.Create;
|
||||
rttiType := ctx.GetType(ATypeInfo);
|
||||
rttiType := ctx.GetType(TypeInfo(T));
|
||||
|
||||
if not (rttiType is TRttiRecordType) then
|
||||
raise EArgumentException.Create('PTypeInfo provided is not a record type.');
|
||||
|
||||
Reference in New Issue
Block a user