Class SystemUtils

  • All Implemented Interfaces:

    
    public class SystemUtils
    
                        

    Created by weiqinxiao on 15/10/14.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public static Context applicationContext
    • Constructor Summary

      Constructors 
      Constructor Description
      SystemUtils()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static Context getApplicationContext()
      static void setApplicationContext(Context context)
      static String getCurrentProcessName(Context context)
      static boolean isMainProcess(Context context) 当前进程是否为主进程。
      static boolean isValidAppKey(String appKey) 服务端 appKey 目前的策略:只包含小写字母或数字。 客户端为了便于以后的扩展,增加大写字母的逻辑。 校验字符串是否只包含 a-z、A-Z、0-9.
      static String listToString(List<String> list) 将 List转换成 String。 每个 String 之间用 , 分隔
      static String listCmpDataToString(List<CmpData> list) 将 List转换成 String。 每个 CmpData 之间用 , 分隔, CmpData 的 addr、protocol、weight 之间用 ; 分隔
      static String mapToString(Map map) Map 转 string。 每个 entry 之间用 ; 分隔, key 和 value 之间用:分隔
      static boolean isParameterValid(ConversationType conversationType, String targetId, String channelId)
      static boolean isConversationTypeValid(ConversationType conversationType)
      static boolean isTargetIdValid(String targetId)
      static boolean isChannelIdValid(String channelId)
      static boolean nonSupportSuperGroup(ConversationType conversationType)
      static boolean judgeUIDInvalid(String messageUId, OperationCallback callback)
      static boolean judgeListInvalid(List<String> keyArray, OperationCallback callback)
      static boolean judgeMapInvalid(Map<String, String> expansion, OperationCallback callback)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SystemUtils

        SystemUtils()
    • Method Detail

      • getCurrentProcessName

         static String getCurrentProcessName(Context context)
        Parameters:
        context - 上下文
        Returns:

        当前进程名

      • isMainProcess

         static boolean isMainProcess(Context context)

        当前进程是否为主进程。

        Parameters:
        context - 上下文
        Returns:

        当前进程是否为主进程。true 是主进程; false 不是主进程。

      • isValidAppKey

         static boolean isValidAppKey(String appKey)

        服务端 appKey 目前的策略:只包含小写字母或数字。 客户端为了便于以后的扩展,增加大写字母的逻辑。 校验字符串是否只包含 a-z、A-Z、0-9. 长度小于等于 20.

        Parameters:
        appKey - 待校验字符串
        Returns:

        true 符合条件

      • listToString

         static String listToString(List<String> list)

        将 List转换成 String。 每个 String 之间用 , 分隔

        Parameters:
        list - 待转换的 List
        Returns:

        转换后的 String

      • listCmpDataToString

         static String listCmpDataToString(List<CmpData> list)

        将 List转换成 String。 每个 CmpData 之间用 , 分隔, CmpData 的 addr、protocol、weight 之间用 ; 分隔

        Parameters:
        list - 待转换的 List
        Returns:

        转换后的 String

      • mapToString

         static String mapToString(Map map)

        Map 转 string。 每个 entry 之间用 ; 分隔, key 和 value 之间用:分隔

        Parameters:
        map - 待转换的 map
        Returns:

        转换完的字符串。

      • isParameterValid

         static boolean isParameterValid(ConversationType conversationType, String targetId, String channelId)
      • judgeUIDInvalid

         static boolean judgeUIDInvalid(String messageUId, OperationCallback callback)
      • judgeListInvalid

         static boolean judgeListInvalid(List<String> keyArray, OperationCallback callback)
      • judgeMapInvalid

         static boolean judgeMapInvalid(Map<String, String> expansion, OperationCallback callback)