Class version in java

2

I would like to know if in java you have how to specify a tag, or manifest, or something of the type for a class or library and can query this within the Java code itself type:

@version 2.6.5
Class Pessoa {
...
}

and in another part of the code

if (Class.getVersion(Pessoa) < 2.7)
{
   mensage.Aviso("Biblioteca de Pessoas em uma versão antiga. Atualize-o");
}
    
asked by anonymous 27.11.2015 / 17:27

1 answer

1

Hello,

I do not know anything that suits what I want, nor can I see any use for it. The question is do you really need this? If you want to version your class you can use git , mercurial or svn . Also what you can do is check from a .class which is the minor and major version of Java in which your class was compiled.

java -verbose MyClass

But if you still want something like what you posted, you can create an Annotation yourself and make a logic.

    
27.11.2015 / 21:35