J. Doe
J. Doe

Reputation: 33

Xbase - How to add tags on top on inferrer generated methods

I have figured out how to create methods and add to the bodies of the method. What I need to also do is add annotations to the generated method such as @Test etc, how would I accomplish this?

Upvotes: 2

Views: 58

Answers (1)

Christian Dietrich
Christian Dietrich

Reputation: 11868

if you want to infer annotatations inside the inferrer you could do something like

members += greeting.toMethod("testHello" + greeting.name, typeRef(Void.TYPE)) [
    annotations += "org.junit.Test".annotationRef()
    body = '''
        // TODO
    '''
]

Upvotes: 2

Related Questions