Retorna um array contendo as Annotation atribuídas a uma propriedade de um objeto.
Sintaxe
Reflection.getDataAnnotationList( oObj, cPropertyName )
Parâmetros
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
oObj | objeto | Indica o objeto onde será procurado a Annotation. | X | |
cPropertyName | caractere | Indica o nome da propriedade onde será procurada a Annotation | X |
Retorno
Nome | Tipo | Descrição |
---|---|---|
aRet | Array | Array contendo em cada posição um objeto Json contendo o valor de cada Annotation atribuída a propriedade do objeto. Caso nenhuma Annotation seja encontrada, retorna NIL. |
Exemplos
exemplo1.tlpp
#include "tlpp-core.th" @annotation AnnotationGetDataAnnotationList01 teste1 as char @end @annotation AnnotationGetDataAnnotationList02 teste2 as char @end Class GetDataAnnotationList @AnnotationGetDataAnnotationList01(teste1 = "Primeira Annotation") @AnnotationGetDataAnnotationList02(teste2 = "Segunda Annotation") Public data data1 Public Method New() EndClass Method New() class GetDataAnnotationList Return Self Function u_testGetDataAnnotationList() Local oObj := GetDataAnnotationList():New() Local aRet as array aRet := Reflection.getDataAnnotationList(oObj,"data1") Conout(aRet[1]["teste1"]) Conout(aRet[2]["teste2"]) Return
Resultado do Exemplo
Primeira Annotation
Segunda Annotation
Abrangência
17.3.0.3
Veja também
Visão Geral
Import HTML Content
Conteúdo das Ferramentas