Histórico da Página
...
Pagetitle | ||||
---|---|---|---|---|
|
Retorna um array com o nome de todas as funções que tem uma determinada annotationEfetua a busca de uma Annotation em funções a partir do namespace.
Sintaxe
Bloco de código | ||
---|---|---|
| ||
Reflection.getFunctionsByAnnotation( cAnnotationName,[cNamespaceNameFilter]) ) |
...
Nome | Tipo | Descrição |
---|---|---|
aRet | array | Array multidimensional com o nome dos fontes e das funções que contém a Annotation procurada.
|
Exemplos
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
/* Programa test_doc_resourceGetFunctionsByAnnotation.tlpp */ #include "tlpp-core.th" namespace namespaceGetFunctionsByAnnotation @annotation AnnotationExemplo resourceExemplo as char @end @AnnotationExemplo(resourceExemplo='Valor de Exemplo1') function u_resourceGetFunctionsByAnnotation1() return @AnnotationExemplo(resourceExemplo='Valor de Exemplo2') function u_resourceGetFunctionsByAnnotation2() return @AnnotationExemplo(resourceExemplo='Valor de Exemplo3') function u_resourceGetFunctionsByAnnotation3() return |
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
//Definicoes das annotation, deve estar num fonte #include "msobjecttlpp-core.chth" namespace exemplo @annotation AnnotationExemplo nickname as char @end @AnnotationExemplo(nickname = "MeuObject") main Function AnnotationTeste() conout("AnnotationTeste") Return Main Function Exemplo() retVar function u_testGetFunctionsByAnnotation() local aRet := {} as array aRet := Reflection.getFunctionsByAnnotation("AnnotationExemplo", "exemplo.*namespaceGetFunctionsByAnnotation" ) //procura por todas as classes do namespace exemplo varinfo("retVar", retVar) Return cJson |
Resultado do Exemplo
retVar -> ARRAY ( 2) [...]
retVar[1] -> ARRAY ( 2) [...]
retVar[1][1] C ( 12) [EXEMPLO.TLPP]
retVar[1][2] C ( 12) [EXEMPLO.OBJ1]
retVar[2] -> ARRAY ( 2) [...]
retVar[2][1] C ( 12) [EXEMPLO.TLPP]
if(valType(aRet) == 'A' .and. len(aRet) > 0)
aEval(aRet,{|x| aEval(x,{|y| conout(y)})})
else
conout('Nao foi possivel encontrar a Annotation com os parametros solicitados')
endif
return |
Resultado do Exemplo
aRet[1][2] - TEST_DOC_RESOURCEGETFUNCTIONSBYANNOTATION.TLPP
aRet[1][2] - NAMESPACEGETFUNCTIONSBYANNOTATION.U_RESOURCEGETFUNCTIONSBYANNOTATION1
aRet[2][1] - TEST_DOC_RESOURCEGETFUNCTIONSBYANNOTATION.TLPP
aRet[2][2] - NAMESPACEGETFUNCTIONSBYANNOTATION.U_RESOURCEGETFUNCTIONSBYANNOTATION2
aRet[3][1] -TEST_DOC_RESOURCEGETFUNCTIONSBYANNOTATION.TLPP
aRet[3][2] -NAMESPACEGETFUNCTIONSBYANNOTATION.U_RESOURCEGETFUNCTIONSBYANNOTATION3retVar[2][2] C ( 12) [EXEMPLO.OBJ2]
Abrangência
17.3.0.3
Veja também
...