Histórico da Página
...
Nome | Tipo | Descrição | Obrigatório | Referência |
|---|---|---|---|---|
oObj | objeto | Objeto onde está definido o método cujas Annotation serão retornadas | X | |
cMethodName | caractere | Método onde serão procuradas as Annotations | X |
Retorno
Nome | Tipo | Descrição |
|---|---|---|
jRetaRet | array Caso | não encontre annotation alguma, retorna NIL. Senão, retorna um array onde cada posição é um Json Object representando uma Annotation encontradaArray contendo em cada posição um objeto do tipo Json onde cada propriedade é o nome da Annotation encontrada. Caso nada seja encontrado, seu valor é NIL. |
Exemplos
| Bloco de código | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
#include "tlpp-core.th" @annotation AnnotationUm testeAnnotationGetMethodAnnotationList01 teste1 as char @end @annotation AnnotationDoisAnnotationGetMethodAnnotationList02 teste2 teste as char @end classClass MeuObjeto public data data1 public method new() @AnnotationUm(testeGetMethodAnnotationList Public Method New() @AnnotationGetMethodAnnotationList01(teste1 = "CompanyPrimeira Annotation") @AnnotationDois(teste @AnnotationGetMethodAnnotationList02(teste2 = "TOTVSSegunda Annotation") Public Method MethodWithAnnotation() EndClass Method New() class public method exemplo() EndClass main function usoDeAnnotation() localGetMethodAnnotationList Return Self Method MethodWithAnnotation() class GetMethodAnnotationList Return Function u_testGetMethodAnnotationList(aResult) Local oObj := MeuObjetoGetMethodAnnotationList():New() localLocal jRetaRet jRetaRet := Reflection.getMethodAnnotationList(oObj, "exemploMethodWithAnnotation") conoutConout(Len(jRetaRet)) conoutConout(jRetaRet[1]["testeteste1"]) conoutConout(jRetaRet[2]["testeteste2"]) returnReturn |
Resultado do Exemplo
2Company
Primeira Annotation
TOTVSSegunda Annotation
Abrangência
17.3.0.3
Veja também
...
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas