Árvore de páginas

Versões comparadas

Chave

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

...

Pagetitle
Reflection.isAnnotationMethodPresent
Reflection.isAnnotationMethodPresent

Procura Efetua a busca de uma Annotation em uma propriedade método de um objeto.

Sintaxe

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

...

Nome

Tipo

Descrição

Obrigatório

Referência

oObjxParam

objeto/caractere**

Objeto instância da classe/nome da classe** proprietário/a do método onde será procurada Indica o objeto onde será procurado a Annotation.

X


cMethodName

caractere

Indica o nome Nome do método onde será procurada a Annotation.

X


cAnnotationName
caractereIndica o nome Nome da Annotation que será procurada. X           X

Retorno

Nome

Tipo

Descrição

lRet

numéricologico

Retorna .T. caso encontre a Annotation e .F. caso não encontre.

Exemplos

Bloco de código
languagecpp
themeEclipse
titleexemplo1.tlpp
linenumberstrue
@interface AnnotationExemplo
    #include "tlpp-core.th"

@annotation AnnotationIsAnnotationMethodPresent
nickname as char
@end

Class IsAnnotationMethodPresent

	Public 
class MeuObjeto
    public data data1
    public method new()
    @AnnotationExemplo(nickname = "Company")
	public method exemplo()
EndClass
 
 
main function usoDeAnnotation()
    local oObj := MeuObjeto():New()
    conout(Reflection.isAnnotationMethodPresent(oObj, "exemplo", "AnnotationExemplo"))
    conout(Reflection.isAnnotationMethodPresent(oObj, "exemplo", "Teste"))
return

...

Method New()

	@AnnotationIsAnnotationMethodPresent(nickname = "Company")
	Public Method MethodWithAnnotation()
EndClass

Method New() class IsAnnotationMethodPresent
Return Self

Method MethodWithAnnotation() class IsAnnotationMethodPresent
Return

Function u_testIsAnnotationMethodPresent()
	Local oObj := IsAnnotationMethodPresent():New()
	Conout(Reflection.isAnnotationMethodPresent(oObj, "MethodWithAnnotation", "AnnotationIsAnnotationMethodPresent"))
	Conout(Reflection.isAnnotationMethodPresent(oObj, "MethodWithAnnotation", "NoExist"))
Return
Bloco de código
languagecpp
themeEclipse
titleexemplos2.tlpp
linenumberstrue
#include "tlpp-core.th"

@annotation AnnotationIsAnnotationMethodPresent
nickname as char
@end

Class IsAnnotationMethodPresent

	Public Method New()

	@AnnotationIsAnnotationMethodPresent(nickname = "Company")
	Public Method MethodWithAnnotation()
EndClass

Method New() class IsAnnotationMethodPresent
Return Self

Method MethodWithAnnotation() class IsAnnotationMethodPresent
Return

Function u_testIsAnnotationMethodPresent()
	
	Conout(Reflection.isAnnotationMethodPresent("IsAnnotationMethodPresent", "MethodWithAnnotation", "AnnotationIsAnnotationMethodPresent"))
	Conout(Reflection.isAnnotationMethodPresent("IsAnnotationMethodPresent", "MethodWithAnnotation", "NoExist"))
Return

Resultado dos Exemplos

.T.

.F.

Abrangência

17.3.0.3

...