import.css=/download/attachments/6062824/tecnologia.css |
Efetua a busca de uma Annotation atribuída a uma propriedade de um objeto.
Reflection.getDataAnnotation( xParam, cPropertyName, cAnnotationName ) |
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
xParam** | objeto/caractere** | Objeto instância da classe/nome da classe** onde será feita a busca da Annotation. | X | |
cPropertyName | caractere | Nome da propriedade onde será procurada a Annotation | X | |
cAnnotationName | caractere | Nome da Annotation que será procurada. | X |
A partir do build 24.3.0.0,também haverá a opção de passar simplesmente o nome da classe em xParam, conforme exemplo 2. Mas continua valendo a passagem da instância do objeto (exemplo 1). |
Nome | Tipo | Descrição |
---|---|---|
jRet | objeto | Retorna um objeto do tipo Json contendo o valor da Annotation na propriedade indicada e NIL caso não encontre. |
#include "tlpp-core.th" @annotation DataAnnotation nickname as char @end Class GetDataAnnotation @DataAnnotation(nickname = "Company") Public data data1 Public Method New() EndClass Method New() class GetDataAnnotation Return Self Function u_testGetDataAnnotation() Local oObj := GetDataAnnotation():New() Local jRet jRet := Reflection.getDataAnnotation(oObj, "data1", "DataAnnotation") if(valType(jRet) <> 'U') Conout(jRet["nickname"]) EndIf Return |
#include "tlpp-core.th" @annotation DataAnnotation nickname as char @end Class GetDataAnnotation @DataAnnotation(nickname = "Company") Public data data1 Public Method New() EndClass Method New() class GetDataAnnotation Return Self Function u_testGetDataAnnotation() Local jRet jRet := Reflection.getDataAnnotation("GetDataAnnotation", "data1", "DataAnnotation") if(valType(jRet) <> 'U') Conout(jRet["nickname"]) EndIf Return |
Company
17.3.0.3