How to implement a parameterized method in an interface for use in the Spring Framework

I am trying to integrate the Aurelius ORI framework and Spring 4D framework, and for the most part I am succeeding, however ORUR Aurelius (and others) rely on the "Object Manager" to load and save the objects in the database. Part of the work I'm doing is trying to separate as much as possible from the implementation and class interfaces. However, when creating an interface for this object manager (TObjectManager in Aurelius), it is difficult for me to execute the Find method of the object manager. For example, the object manager supports the following methods:

MyObjectManager := TObjectManager.Create(Connection);
ExistingSale := MyObjectManager.Find<TSale>(1); // Find the Sale record with ID = 1 of the class TSale.

Now let's try to convert the ObjectManager declaration to the Im interface, trying to do it like this:

IObjectManager = Interface
     ['{1F54162B-D7D7-4E42-AC9D-D269803371DB}']
     function Find<T>(ID: Integer) : T;
end;

And here is the problem, because the compiler fails with an error:

[DCC Error] E2535 Interface methods must not have parameterized methods

, , :

function TMyOwnObjectManager.Find<T>(ID: Integer) : T;
begin
     Result:=fAureliusObjectManager.Find<T>(ID);
end;

, .

+3
1

, , , , TObjectManager, Find :

function TMyOwnManager.Find(Class: TClass; IdValue: Variant): TObject; 
begin 
    // Call the TObjectManager protected method "Find(Clazz:TClass; IdValue: Variant)" 
    Result := inherited Find(TClass(Class), IdValue); 
end;

, -.

+3

All Articles