java - Can you return Annotations as objects? -
say wanted return version without having create variable, or perhaps serial or reference (@see
), similar to:
public @version getversion() { return /*the @version tag on class*/; }
where @version runtime-visible annotation declared on class or method (and java 8, type annotations)?
i'm not quite sure, perhaps you're looking this:
@version(4) public class thisclass { public static version getversion () { return thisclass.class.getannotation(version.class); } }
i'm not sure precise "version" annotation you're using, or if you're trying do, seems possible answer kind of problem you're trying solve.
Comments
Post a Comment