KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > core > SpringVersion


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.core;
18
19 /**
20  * Class that exposes the Spring version. Fetches the
21  * "Implementation-Version" manifest attribute from the jar file.
22  *
23  * <p>Note that some ClassLoaders do not expose the package metadata,
24  * hence this class might not be able to determine the Spring version
25  * in all environments. Consider using a reflection-based check instead:
26  * For example, checking for the presence of a specific Spring 2.0
27  * method that you intend to call.
28  *
29  * @author Juergen Hoeller
30  * @since 1.1
31  */

32 public class SpringVersion {
33
34     /**
35      * Return the full version string of the present Spring codebase,
36      * or <code>null</code> if it cannot be determined.
37      * @see java.lang.Package#getImplementationVersion()
38      */

39     public static String JavaDoc getVersion() {
40         Package JavaDoc pkg = SpringVersion.class.getPackage();
41         return (pkg != null ? pkg.getImplementationVersion() : null);
42     }
43
44 }
45
Popular Tags