//Definicoes das annotation, deve estar num fonte
#include "tlpp-object.th"
@annotation metodo
@end
@annotation classeMetodo
@end
@classeMetodo()
Class NovaClasseMetodo
@metodo()
Public Method MetodoTeste(param1)
Public Method New()
endclass
Method New() class NovaClasseMetodo
return self
Method MetodoTeste(param1) class NovaClasseMetodo
local novaString := "{ " + param1 + " }"
return novaString
Main Function testeMetodo()
local ObjMethod
local classes
local obj1
local ret
classes := Reflection.getClassesByAnnotation("classeMetodo", "") // vazio para pegar todas as classes do repositorio
obj1 := classes[1]:CreateInstance("Instancia 1")
ObjMethod := Reflection.getMethodsObjectByAnnotation(obj1, "metodo")
ret := ObjMethod[1]:Execute(obj1, "Teste Parametro")
Conout(ret)
return |