Efetua a busca de Annotation em um objeto e retorna o seu valor.
Sintaxe
Reflection.getObjectAnnotation( oObj, cAnnotationName )
Parâmetros
Nome | Tipo | Descrição | Obrigatório | Referência |
|---|---|---|---|---|
oObj | objeto | Objeto onde será procurado a Annotation. | X | |
cAnnotationName | caractere | Nome da Annotation a ser procurada. | X |
Retorno
Nome | Tipo | Descrição |
|---|---|---|
jRet | object | Objeto Json cuja propriedade é a Annotation contendo seu valor. Caso não encontre o retorno é NIL |
Exemplos
test_doc_getObjectAnnotation.tlpp
#include "tlpp-core.th"
@annotation AnnotationGetObjectAnnotation
nickname as char
@end
@AnnotationGetObjectAnnotation(nickname = "Totvs")
Class GetObjectAnnotation
Public Method New()
EndClass
Method New() class GetObjectAnnotation
Return Self
Function u_testGetObjectAnnotation(aResult)
Local oObj := GetObjectAnnotation():New()
Local jRet
jRet := Reflection.getObjectAnnotation(oObj, "AnnotationGetObjectAnnotation")
if (valType(jRet) <> 'U')
conout(jRet["nickname"])
else
conout('Nao foi encontrada Annotation com os parametros informados')
endIf
Return
Resultado do Exemplo
Totvs
Abrangência
17.3.0.3
Veja também
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas