Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
Composition Setup
import.css=/download/attachments/6062824/tecnologia.css

Pagetitle
Reflection.getClassAnnotationgetClassAnnotationList
Reflection.getClassAnnotationgetClassAnnotationList

Retorna uma array com todas as anotações Annotations utilizadas na classe.

Sintaxe

Bloco de código
collapsefalse
Reflection.getClassAnnotationList( cClassName)

Parâmetros

Nome

Tipo

Descrição

Obrigatório

Referência

cClassName

caractere

INome Nome da classe cujas anotações Annotations serão retornadas

X


Retorno

Nome

Tipo

Descrição

jRetaRet

Array de JsonObjectArray 

Retorna um array que contém , em cada posição , um objeto Json que represente com a sua respectiva Annotation. Seu valor será NIL caso nenhuma annotation Annotation seja encontrada.

Exemplos

Bloco de código
languagecpp
themeEclipse
titleexemplo1.tlpp
linenumberstrue
@interface AnnotationUm#include "tlpp-core.th"
 
@annotation PrimeiraAnnotation
    nicknameempresa as char
@end
  
  
@interface@annotation AnnotationDoisSegundaAnnotation
    tipo as char
@end
   
  
@AnnotationUm@PrimeiraAnnotation(nicknameempresa = "CompanyTotvs")
@AnnotationDois@SegundaAnnotation(tipo = "Teste ListaSoftware")

class MeuObjetoGetClassAnnotationList
    public data data1
    public method new()
EndClass
   
Method new() Class MeuObjetoGetClassAnnotationList
return self
   
main function AnnotationListu_testGetClassAnnotationList()

    local oObj aRet as array
  
    aRet := MeuObjeto():New(Reflection.getClassAnnotationList("GetClassAnnotationList")
    local jRet
 
   if jRet := Reflection.getClassAnnotationList("MeuObjeto"(valType(aRet) == "A") .and. (len(aRet) > 0)
      conout(jRetaRet[1]["nicknameempresa"])
      conout(jRetaRet[2]["tipo"])
    else
      conout('Não foi encontrada nenhuma Annotation na classe declarada !')  
    endif
return

Resultado do Exemplo

CompanyTotvs

Teste ListaSoftware

Abrangência

17.3.0.3

Veja também