类 CoreUtil

java.lang.Object
com.tlcsdm.core.util.CoreUtil

public class CoreUtil extends Object
工具包
  • 构造器详细资料

    • CoreUtil

      private CoreUtil()
  • 方法详细资料

    • valueOf

      public static String valueOf(Object obj)
      Object为null时, toString()会返回 "null". 本方法会在Object为null时返回空串.
    • toLowerCase4Index

      public static String toLowerCase4Index(String string)
      首字母小写
    • toUpperCase4Index

      public static String toUpperCase4Index(String string)
      首字母大写
    • toUpperCase

      public static char toUpperCase(char chars)
      字符转成大写
    • newHashMapWithExpectedSize

      public static int newHashMapWithExpectedSize(int expectedSize)
      根据容量获取map初始大小, 参考JDK8中putAll方法中的实现以及guava的newHashMapWithExpectedSize方法
      参数:
      expectedSize - 容量大小
    • deepClone

      public static Object deepClone(Object object)
      深度克隆
    • openWeb

      public static void openWeb(String url)
      使用默认浏览器打开url
    • sortByOrder

      public static void sortByOrder(List<Class<?>> list)
      根据Order注解排序 不存在注解则排到最后
    • getRootPath

      public static String getRootPath()
      获取项目根目录 eclipse下的根目录和idea不同
    • getRuntimePath

      public static String getRuntimePath()
      获取运行位置下runtime文件夹.
    • isStartupFromJar

      public static boolean isStartupFromJar(Class<?> clazz)
      判断类是否在jar中
    • hasClass

      public static boolean hasClass(String className)
      类是否存在,存在返回true.
    • getDomainName

      public static String getDomainName(String url)
      从url中获取域名.
    • getWorkEnv

      public static String getWorkEnv()
      获取当前workEnv. 虚拟机参数workEnv为空时,如果当前在jar包启动则时生产环境,否则认为是开发环境
    • readStream

      public static String readStream(InputStream in)
      读取 InputStream 到 String字符串中.
    • listToMap

      public static <T, F> Map<F,T> listToMap(List<T> list, Function<T,F> keyMapper)
      list 转换 map.
      参数:
      list -
      keyMapper -
    • listToMap

      public static <T, F> Map<F,T> listToMap(List<T> list, Function<T,F> keyMapper, Consumer<T> consumer, Predicate<T> filter)
      list 转换 map.
      参数:
      list -
      keyMapper -
      consumer -
      filter -
    • defaultMegerFunction

      public static <T> BinaryOperator<T> defaultMegerFunction()
      返回:
      deafult meger function