Is this possible to get an int array in a custom annotation?
If yes, how to I call it?
Here's a dummy example to help me understand... Suppose that I have @Add() that takes an infinite number of operand.
@Add(operand1=10, operand2=20, operandx=...)
What I want is to have only one property operands.
You can achieve what you want if you add a parameter to the interface as an array.
public @interface Add {
int [] operands();
}
Then usage would be :
@Add(operands={1,2,3})
Note: var-args would not work; the compiler will reject it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.