From: Debayan Sutradhar Date: Fri, 18 Dec 2020 00:50:10 +0530 Subject: Refactored code --- Refactored code --- --- 'a/.gitignore' +++ b/.gitignore @@ -1,3 +1,9 @@ .idea/ target/ -Util.iml \ No newline at end of file +Util.iml + + +.settings/ +.project +.factorypath +.classpath --- 'a/src/main/java/com/StreamPi/Util/Platform/Platform.java' +++ b/src/main/java/com/StreamPi/Util/Platform/Platform.java @@ -1,21 +1,23 @@ package com.StreamPi.Util.Platform; public enum Platform { - WINDOWS, LINUX, MAC, ANDROID, IOS, LINUX_RPI, UNKNOWN; + WINDOWS("Windows"), + LINUX("Linux"), + MAC("MacOS"), + ANDROID("Android"), + IOS("iOS"), + LINUX_RPI("Raspberry Pi"), + UNKNOWN("Unknown"); - public static String getUIName(Platform platform) + final private String UIName; + + Platform(String UIName) + { + this.UIName = UIName; + } + + public String getUIName() { - switch (platform) - { - case WINDOWS: return "Windows"; - case LINUX: return "Linux"; - case LINUX_RPI : return "Linux Raspberry Pi"; - case MAC: return "MacOS"; - case ANDROID: return "Android"; - case IOS: return "iOS"; - case UNKNOWN: - default: - return "Unknown"; - } + return UIName; } } --- 'a/src/main/java/com/StreamPi/Util/Platform/ReleaseStatus.java' +++ b/src/main/java/com/StreamPi/Util/Platform/ReleaseStatus.java @@ -1,23 +1,25 @@ /* ReleaseStatus.java -Contributors : Debayan Sutradhar (@dubbadhar) +Written By : Debayan Sutradhar (@rnayabed) Enum to store the current status of the Server Release - */ +*/ + package com.StreamPi.Util.Platform; public enum ReleaseStatus { - EA, GA; + EA("Early Access"), GA("General Availability"); + + private final String UIName; + + ReleaseStatus(String UIName) + { + this.UIName = UIName; + } - public static String getUIName(ReleaseStatus releaseStatus) + public String getUIName() { - switch (releaseStatus) - { - case EA: return "Early Access"; - case GA: return "General Availability"; - default: - return null; - } + return UIName; } }