模块 mxlib.api

类 Toolkit


  • public class Toolkit
    extends Object
    一个工具集合
    • 构造器详细资料

      • Toolkit

        public Toolkit()
    • 方法详细资料

      • entry

        public static <K,​V> Map.Entry<K,​V> entry​(K k,
                                                             V v)
        类型参数:
        K - The key type
        V - The value type.
        参数:
        k - The entry key
        v - The entry value
        返回:
        A new Entry.
        从以下版本开始:
        2.11
      • toMapCollector

        public static <T,​V,​M extends Map<T,​V>> Collector<Map.Entry<T,​V>,​M,​M> toMapCollector​(Supplier<M> mapCreator)
      • toCallable

        @Contract(pure=true,
                  value="null -> null")
        public static <T> Callable<T> toCallable​(Object cb)
        类型参数:
        T - The type of the callable
        参数:
        cb - The function to invoke.
        返回:
        The callable need check
        从以下版本开始:
        2.5
      • getPackageByClassName

        @NotNull
        @Contract(pure=true)
        public static @NotNull String getPackageByClassName​(String name)
        Get class's package name.
        截取类名的包名字
        参数:
        name - 类的全名
        返回:
        类的包名
      • getClassSimpleName

        @Contract(pure=true)
        public static String getClassSimpleName​(String name)
        Get class's simple name
        获取类名的精简名
        参数:
        name - 类全名
        返回:
        类精简名
      • getPackageComparator

        @Contract(pure=true)
        public static Comparator<String> getPackageComparator()
        Get the package name comparator.
        获取包名比较器
        返回:
        The comparator of package.
        另请参阅:
        getPackageByClassName(String)
      • getClass

        @Contract(value="null -> null",
                  pure=true)
        public static <T> Class<T> getClass​(T obj)
        类型参数:
        T - 对象类型
        返回:
        对象的类|null
        另请参阅:
        Object.getClass()
      • isNum

        @Contract(pure=true)
        public static boolean isNum​(String s)
      • getRoot

        @Contract(pure=true)
        public static ICommands getRoot​(ICommand command)
      • isClassName

        @Contract(value="null -> false",
                  pure=true)
        public static boolean isClassName​(String check)
        Check if the given string is a valid class name
        检查给定的字符串是否是有效的类名
        参数:
        check - The name of check
        返回:
        true if the class name valid
        从以下版本开始:
        2.2
      • fill

        public static <T> void fill​(@NotNull
                                    @NotNull T[] args,
                                    @NotNull
                                    @NotNull Supplier<T> supplier)
        fill the array, 填充数组
        类型参数:
        T - The type of array.
        参数:
        args - The array 数组
        supplier - The supplier 获取器
        从以下版本开始:
        2.4
      • fill

        public static <T> void fill​(@NotNull
                                    @NotNull T[] args,
                                    int off,
                                    int length,
                                    @NotNull
                                    @NotNull Supplier<T> supplier)
        Fill the array 填充数组
        类型参数:
        T - The type of array
        参数:
        args - The array 数组
        off - The start 起始点
        length - length 长度限制
        supplier - The supplier 获取器
        从以下版本开始:
        2.4
      • fill

        public static <T> void fill​(@NotNull
                                    @NotNull T[] args,
                                    @Nullable
                                    T o)
      • fill

        public static <T> void fill​(T[] args,
                                    int off,
                                    int length,
                                    @Nullable
                                    T o)
        File the array with same value. 使用同一个值填充数组
        类型参数:
        T - The type of array
        参数:
        args - The array 数组
        off - start position 起始点
        length - The fill size of array 填充的数组长度
        o - The value 填充值
        从以下版本开始:
        2.4
      • ofUTF8ByteBuffer

        @Contract(pure=true)
        public static ByteBuffer ofUTF8ByteBuffer​(String x)
        把字符串转为 ByteBuffer(UTF_8)
        参数:
        x - 字符串
        返回:
        编码后的ByteBuffer, 如果需要附加字符串长度请使用 position(0)
        从以下版本开始:
        2.4
      • asBoolean

        @Contract(value="null -> false",
                  pure=true)
        public static boolean asBoolean​(Object o)
        return value's boolean value
        参数:
        o - The value
        返回:
        The boolean match
        从以下版本开始:
        2.5