OSDN Git Service

バージョン番号の埋め込み完了
authorhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Sun, 27 Jun 2021 03:28:17 +0000 (12:28 +0900)
committerhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Sun, 27 Jun 2021 03:28:17 +0000 (12:28 +0900)
src/com/ranfa/lib/Version.java [new file with mode: 0644]
src/com/ranfa/main/DelesteRandomSelector.java

diff --git a/src/com/ranfa/lib/Version.java b/src/com/ranfa/lib/Version.java
new file mode 100644 (file)
index 0000000..a193d9e
--- /dev/null
@@ -0,0 +1,12 @@
+package com.ranfa.lib;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Version {
+       String value();
+}
index f9ac19f..c87a5e3 100644 (file)
@@ -7,6 +7,9 @@ import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.border.EmptyBorder;
 
+import com.ranfa.lib.Version;
+
+@Version("v1.0.0")
 public class DelesteRandomSelector extends JFrame {
 
        private JPanel contentPane;
@@ -31,6 +34,7 @@ public class DelesteRandomSelector extends JFrame {
         * Create the frame.
         */
        public DelesteRandomSelector() {
+               // System.out.println(getVersion());
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                setBounds(100, 100, 450, 300);
                contentPane = new JPanel();
@@ -39,4 +43,15 @@ public class DelesteRandomSelector extends JFrame {
                setContentPane(contentPane);
        }
 
+
+       /**
+        * アノテーションで記載されているバージョンを取得します
+        * @since v1.0.0
+        * @return アノテーションで定義されているバージョン
+        */
+       public static String getVersion() {
+               Version version = (Version) DelesteRandomSelector.class.getAnnotation(Version.class);
+               return version.value();
+       }
+
 }