Histórico da Página
Composition Setup |
---|
import.css=/download/attachments/6062824/tecnologia.css |
Pagetitle | ||||
---|---|---|---|---|
|
Efetua a busca da Annotation dentro de um objeto retornando uma lista contendo o(s) nome(s) do(s) método(s) onde a mesma foi encontrada.
...
Bloco de código | ||
---|---|---|
| ||
Reflection.getMethodsByAnnotation( oObjxParam,cAnnotationName ) |
Parâmetros
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
oObjxParam** | objeto/caractere** | Objeto instância da classe/nome da classe** na qual a busca será realizada | X | |
cAnnotationName | caractere | Nome da Annotation a ser procurada | X |
Informações | ||
---|---|---|
| ||
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). |
Retorno
Nome | Tipo | Descrição |
---|---|---|
aRet | Array | Array contendo os métodos que possuem a Annotation solicitada. Caso não encontre a array retorna vazia. |
...
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include "tlpp-core.th"
@annotation AnnotationGetMethodsByAnnotation
property1 as char
@end
Class GetMethodsByAnnotation
Public Method New()
@AnnotationGetMethodsByAnnotation(property1 = "Method Annotation")
Public Method MethodWithAnnotation()
@AnnotationGetMethodsByAnnotation(property1 = "Method Annotation")
Public Method AnotherMethodWithAnnotation()
EndClass
Method New() class GetMethodsByAnnotation
Return Self
Method MethodWithAnnotation() class GetMethodsByAnnotation
Return
Method AnotherMethodWithAnnotation() class GetMethodsByAnnotation
Return
Function u_testGetMethodsByAnnotation()
Local aRet := {} as array
Local oObj
oObj := GetMethodsByAnnotation():New()
aRet := Reflection.getMethodsByAnnotation(oObj, "AnnotationGetMethodsByAnnotation")
if(valType(aRet) == "A" .and. len(aRet) > 0)
aEval(aRet,{|x| Conout(x)} )
else
Conout('Nao foi encontrada Annotation com os parametros solicitados')
endIf
Return
|
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include "tlpp-core.th"
@annotation AnnotationGetMethodsByAnnotation
property1 as char
@end
Class GetMethodsByAnnotation
Public Method New()
@AnnotationGetMethodsByAnnotation(property1 = "Method Annotation")
Public Method MethodWithAnnotation()
@AnnotationGetMethodsByAnnotation(property1 = "Method Annotation")
Public Method AnotherMethodWithAnnotation()
EndClass
Method New() class GetMethodsByAnnotation
Return Self
Method MethodWithAnnotation() class GetMethodsByAnnotation
Return
Method AnotherMethodWithAnnotation() class GetMethodsByAnnotation
Return
Function u_testGetMethodsByAnnotation()
Local aRet := {} as array
aRet := Reflection.getMethodsByAnnotation("GetMethodsByAnnotation", "AnnotationGetMethodsByAnnotation")
if(valType(aRet) == "A" .and. len(aRet) > 0)
aEval(aRet,{|x| Conout(x)} )
else
Conout('Nao foi encontrada Annotation com os parametros solicitados')
endIf
Return
|
Resultado
...
dos Exemplos
ANOTHERMETHODWITHANNOTATION
METHODWITHANNOTATION
...
Visão Geral
Import HTML Content
Conteúdo das Ferramentas