|
|
@@ -1,41 +1,41 @@
|
|
|
-package com.uas.report.util;
|
|
|
-
|
|
|
-/**
|
|
|
- * 请求来自的平台
|
|
|
- *
|
|
|
- * @author sunyj
|
|
|
- * @since 2017年8月7日 下午3:27:31
|
|
|
- */
|
|
|
-public enum Platform {
|
|
|
- PC, PHONE;
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取平台类型
|
|
|
- *
|
|
|
- * @param platform
|
|
|
- * @return 获取的平台类型, 失败则返回null
|
|
|
- */
|
|
|
- public static Platform getPlatform(String platform) {
|
|
|
- try {
|
|
|
- return Platform.valueOf(platform.toUpperCase());
|
|
|
- } catch (IllegalArgumentException e) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取平台类型
|
|
|
- *
|
|
|
- * @param platform
|
|
|
- * @return 获取的平台类型
|
|
|
- * @throws IllegalArgumentException
|
|
|
- * 失败,抛出异常
|
|
|
- */
|
|
|
- public static Platform checkPlatform(String platform) throws IllegalArgumentException {
|
|
|
- Platform p = getPlatform(platform);
|
|
|
- if (p == null) {
|
|
|
- throw new IllegalArgumentException("输入不合法:" + platform);
|
|
|
- }
|
|
|
- return p;
|
|
|
- }
|
|
|
-}
|
|
|
+package com.uas.report.model;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 请求来自的平台
|
|
|
+ *
|
|
|
+ * @author sunyj
|
|
|
+ * @since 2017年8月7日 下午3:27:31
|
|
|
+ */
|
|
|
+public enum Platform {
|
|
|
+ PC, PHONE;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取平台类型
|
|
|
+ *
|
|
|
+ * @param platform
|
|
|
+ * @return 获取的平台类型, 失败则返回null
|
|
|
+ */
|
|
|
+ public static Platform getPlatform(String platform) {
|
|
|
+ try {
|
|
|
+ return Platform.valueOf(platform.toUpperCase());
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取平台类型
|
|
|
+ *
|
|
|
+ * @param platform
|
|
|
+ * @return 获取的平台类型
|
|
|
+ * @throws IllegalArgumentException
|
|
|
+ * 失败,抛出异常
|
|
|
+ */
|
|
|
+ public static Platform checkPlatform(String platform) throws IllegalArgumentException {
|
|
|
+ Platform p = getPlatform(platform);
|
|
|
+ if (p == null) {
|
|
|
+ throw new IllegalArgumentException("输入不合法:" + platform);
|
|
|
+ }
|
|
|
+ return p;
|
|
|
+ }
|
|
|
+}
|