commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@gmail.com>
Subject Re: Version classes
Date Wed, 15 Sep 2010 12:41:32 GMT
> James Carman wrote:

> 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);

Implementation note: getPackage() must be checked against null.

Jochen


-- 
I Am What I Am And That's All What I Yam (Popeye)

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


Mime
View raw message