import.css=/download/attachments/6062824/tecnologia.css |
Efetua busca da Annotation em um objeto e retorna uma array com o(s) método(s) onde a mesma foi encontrada.
Reflection.getMethodsObjectByAnnotation( xParam,cAnnotationName ) |
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
xParam** | objet/caractere | Objeto instância da classe/nome da classe** onde a busca pela Annotation será realizada | X | |
cAnnotationName | caractere | Nome da Annotation a ser procurada | X |
A partir do build 24.3.0.0, também haverá a opção de passar simplesmente o nome da classe em xParam, conforme exemplo 2. Mas continua valendo a passagem da instância do objeto (exemplo 1). |
Nome | Tipo | Descrição |
---|---|---|
aRet | Array | Array contendo em cada posição um objeto Json com a propriedade cMethodName onde o valor é o método onde a Annotation foi encontrada. Caso não haja resultado a array retorna vazia. |
#include "tlpp-core.th" @annotation AnnotationGetMethodsObjectByAnnotation @end Class GetMethodsObjectByAnnotation Public Method New() @AnnotationGetMethodsObjectByAnnotation() Public Method MethodWithAnnotation() EndClass Method New() class GetMethodsObjectByAnnotation Return Self Method MethodWithAnnotation() class GetMethodsObjectByAnnotation Return Function u_testGetMethodsObjectByAnnotation() Local ObjMethod Local oObj oObj := GetMethodsObjectByAnnotation():New() ObjMethod := Reflection.getMethodsObjectByAnnotation(oObj, "AnnotationGetMethodsObjectByAnnotation") Conout("Nome do Metodo: " + ObjMethod[1]:cMethodName) Return |
#include "tlpp-core.th" @annotation AnnotationGetMethodsObjectByAnnotation @end Class GetMethodsObjectByAnnotation Public Method New() @AnnotationGetMethodsObjectByAnnotation() Public Method MethodWithAnnotation() EndClass Method New() class GetMethodsObjectByAnnotation Return Self Method MethodWithAnnotation() class GetMethodsObjectByAnnotation Return Function u_testGetMethodsObjectByAnnotation() Local ObjMethod Local oObj ObjMethod := Reflection.getMethodsObjectByAnnotation("GetMethodsObjectByAnnotation", "AnnotationGetMethodsObjectByAnnotation") Conout("Nome do Metodo: " + ObjMethod[1]:cMethodName) Return |
Nome do Metodo: MethodWithAnnotation
17.3.0.3