]> git.basschouten.com Git - openhab-addons.git/blob
9b7174634c1c5fcb020c92b1589e3d021013b0f7
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.velux.internal.utils;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.osgi.framework.FrameworkUtil;
17
18 /**
19  * This is a helper class for dealing with information from MANIFEST file.
20  *
21  * It provides the following methods:
22  * <ul>
23  * <li>{@link #getBundleVersion} returns the bundle version as specified within the MANIFEST.</li>
24  * </ul>
25  * <p>
26  *
27  * @author Guenther Schreiner - Initial contribution
28  */
29 @NonNullByDefault
30 public class ManifestInformation {
31
32     /*
33      * ************************
34      * ***** Constructors *****
35      */
36
37     /**
38      * Suppress default constructor for creating a non-instantiable class.
39      */
40     private ManifestInformation() {
41         throw new AssertionError();
42     }
43
44     // Class access methods
45
46     /**
47      * Returns the bundle version as specified within the MANIFEST file.
48      *
49      * @return <B>bundleVersion</B> the resulted bundle version as {@link String}.
50      */
51     public static String getBundleVersion() {
52         String osgiBundleVersion = FrameworkUtil.getBundle(ManifestInformation.class).getBundleContext().getBundle()
53                 .toString();
54         return osgiBundleVersion;
55     }
56 }