>versionOf(org.hibernate.Session.class);

That looks like a nice utility to add to [lang].

My preference would be for the sig "getVersion(Class)"

Gary

-----Original Message-----
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Wednesday, September 15, 2010 03:55
To: Commons Developers List
Subject: Re: Version classes

On Wed, Sep 15, 2010 at 6:45 AM, sebb <seb...@gmail.com> wrote:
>
> I like the idea.
>
> Apache JMeter does the same.
>
> It also includes the last SVN revision of whatever workspace was used
> to build it.
>
> Since the version is available to Maven (or Ant) it could update (or
> perhaps create?) the version file as part of the build.
>
> If we decide to include the SVN revision as well, we could also add
> the SVN revision as a new manifest entry.
>
> Which makes me wonder - maybe another way to do this would be to have
> the getVersion() method read the Manifest entry?

We use a method like this:

public static String versionOf(Class c) {
  final String version = c.getPackage().getImplementationVersion();
  return StringUtils.isEmpty(version) ? "n/a" : version;
}

So, if you want to know what version of Hibernate you're using, you'd do:

versionOf(org.hibernate.Session.class);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to