Árvore de páginas

Carregando...

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Bloco de código
collapsefalse
Reflection.getMethodsObjectByAnnotation( oObjxParam,cAnnotationName )

Parâmetros

Nome

Tipo

Descrição

Obrigatório

Referência

xParam**

objet/caractere

Objeto instância da classe/nome da classe**

oObj

objeto

Objeto onde a busca pela Annotation será realizada

X


cAnnotationName 
caractereNome da Annotation a ser procuradaX
Informações
titleImplementação de comportamento

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 em cada posição um objeto Json com a propriedade cMethodName onde o valor é o método onde a Annotation  foi encontrada. Caso não haja resultado a array retorna vazia.

...

Bloco de código
languagecpp
themeEclipse
titletest_doc_getMethodsObjectByAnnotationexemplo1.tlpp
linenumberstrue
#include "tlpp-core.th"

@annotation AnnotationGetMethodsObjectByAnnotation
@end

Class GetMethodsObjectByAnnotation

	Public Method New()

	@AnnotationGetMethodsObjectByAnnotation()
	Public Method MethodWithAnnotation()
EndClass

Method New() class GetMethodsObjectByAnnotation
Return Self

Method MethodWithAnnotation() class GetMethodsObjectByAnnotation
Return

Function u_testGetMethodsObjectByAnnotation()
	Local ObjMethod
	Local oObj

	oObj := GetMethodsObjectByAnnotation():New()

	ObjMethod := Reflection.getMethodsObjectByAnnotation(oObj, "AnnotationGetMethodsObjectByAnnotation")
	Conout("Nome do Metodo: " + ObjMethod[1]:cMethodName)

Return
Bloco de código
languagecpp
themeEclipse
titleexemplo2.tlpp
linenumberstrue
#include "tlpp-core.th"

@annotation AnnotationGetMethodsObjectByAnnotation
@end

Class GetMethodsObjectByAnnotation

	Public Method New()

	@AnnotationGetMethodsObjectByAnnotation()
	Public Method MethodWithAnnotation()
EndClass

Method New() class GetMethodsObjectByAnnotation
Return Self

Method MethodWithAnnotation() class GetMethodsObjectByAnnotation
Return

Function u_testGetMethodsObjectByAnnotation()
	Local ObjMethod
	Local oObj

	ObjMethod := Reflection.getMethodsObjectByAnnotation("GetMethodsObjectByAnnotation", "AnnotationGetMethodsObjectByAnnotation")
	Conout("Nome do Metodo: " + ObjMethod[1]:cMethodName)

Return

Resultado

...

dos Exemplos

Nome do Metodo: MethodWithAnnotation

...