Efetua a busca de uma Annotation em um método de um objeto.
Sintaxe
Reflection.getMethodAnnotation( xParam, cMethodName, cAnnotationName )
Parâmetros
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
xParam | objeto/caractere** | Objeto instância da classe/nome da classe** onde será procurado a Annotation. | X | |
cMethodName | caractere | Nome do método onde será procurada a Annotation. | X | |
cAnnotationName | caractere | Nome da Annotation que será procurada. | X |
Retorno
Nome | Tipo | Descrição |
---|---|---|
jRet | objeto | Objeto Json com a propriedade da Annotation contendo o seu valor. Caso não encontre retorna NIL . |
Exemplos
test_doc_getMethodAnnotation.tlpp
#include "tlpp-core.th" @annotation AnnotationGetMethodAnnotation nickname as char @end Class GetMethodAnnotation Public Method New() @AnnotationGetMethodAnnotation(nickname = "Totvs") Public Method MethodWithAnnotation() EndClass Method New() class GetMethodAnnotation Return Self Method MethodWithAnnotation() class GetMethodAnnotation Return Function u_testGetMethodAnnotation() Local oObj := GetMethodAnnotation():New() Local jRet If (Reflection.isAnnotationMethodPresent(oObj, "MethodWithAnnotation", "AnnotationGetMethodAnnotation")) jRet := Reflection.getMethodAnnotation(oObj, "MethodWithAnnotation", "AnnotationGetMethodAnnotation") Conout(jRet["nickname"]) EndIf Return
Resultado do Exemplo
Company
Abrangência
17.3.0.3
Veja também
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas