xiejun
2024-11-01 80b6cbfc9c861469146318d0b3dd5f8b8b525b8a
Source/BladeX-Tool/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Func.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,2156 @@
/*
 *      Copyright (c) 2018-2028, DreamLu All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: DreamLu å¢æ˜¥æ¢¦ (596392912@qq.com)
 */
package org.springblade.core.tool.utils;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springframework.beans.BeansException;
import org.springframework.core.MethodParameter;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.lang.Nullable;
import org.springframework.util.PatternMatchUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.method.HandlerMethod;
import java.io.Closeable;
import java.io.File;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAccessor;
import java.util.*;
import java.util.function.Supplier;
/**
 * å·¥å…·åŒ…集合,工具类快捷方式
 *
 * @author L.cm
 */
public class Func {
   /**
    * æ–­è¨€ï¼Œå¿…须不能为 null
    * <blockquote><pre>
    * public Foo(Bar bar) {
    *     this.bar = $.requireNotNull(bar);
    * }
    * </pre></blockquote>
    *
    * @param obj the object reference to check for nullity
    * @param <T> the type of the reference
    * @return {@code obj} if not {@code null}
    * @throws NullPointerException if {@code obj} is {@code null}
    */
   public static <T> T requireNotNull(T obj) {
      return Objects.requireNonNull(obj);
   }
   /**
    * æ–­è¨€ï¼Œå¿…须不能为 null
    * <blockquote><pre>
    * public Foo(Bar bar, Baz baz) {
    *     this.bar = $.requireNotNull(bar, "bar must not be null");
    *     this.baz = $.requireNotNull(baz, "baz must not be null");
    * }
    * </pre></blockquote>
    *
    * @param obj     the object reference to check for nullity
    * @param message detail message to be used in the event that a {@code
    *                NullPointerException} is thrown
    * @param <T>     the type of the reference
    * @return {@code obj} if not {@code null}
    * @throws NullPointerException if {@code obj} is {@code null}
    */
   public static <T> T requireNotNull(T obj, String message) {
      return Objects.requireNonNull(obj, message);
   }
   /**
    * æ–­è¨€ï¼Œå¿…须不能为 null
    * <blockquote><pre>
    * public Foo(Bar bar, Baz baz) {
    *     this.bar = $.requireNotNull(bar, () -> "bar must not be null");
    * }
    * </pre></blockquote>
    *
    * @param obj             the object reference to check for nullity
    * @param messageSupplier supplier of the detail message to be
    *                        used in the event that a {@code NullPointerException} is thrown
    * @param <T>             the type of the reference
    * @return {@code obj} if not {@code null}
    * @throws NullPointerException if {@code obj} is {@code null}
    */
   public static <T> T requireNotNull(T obj, Supplier<String> messageSupplier) {
      return Objects.requireNonNull(obj, messageSupplier);
   }
   /**
    * åˆ¤æ–­å¯¹è±¡æ˜¯å¦ä¸ºnull
    * <p>
    * This method exists to be used as a
    * {@link java.util.function.Predicate}, {@code filter($::isNull)}
    * </p>
    *
    * @param obj a reference to be checked against {@code null}
    * @return {@code true} if the provided reference is {@code null} otherwise
    * {@code false}
    * @see java.util.function.Predicate
    */
   public static boolean isNull(@Nullable Object obj) {
      return Objects.isNull(obj);
   }
   /**
    * åˆ¤æ–­å¯¹è±¡æ˜¯å¦ not null
    * <p>
    * This method exists to be used as a
    * {@link java.util.function.Predicate}, {@code filter($::notNull)}
    * </p>
    *
    * @param obj a reference to be checked against {@code null}
    * @return {@code true} if the provided reference is non-{@code null}
    * otherwise {@code false}
    * @see java.util.function.Predicate
    */
   public static boolean notNull(@Nullable Object obj) {
      return Objects.nonNull(obj);
   }
   /**
    * é¦–字母变小写
    *
    * @param str å­—符串
    * @return {String}
    */
   public static String firstCharToLower(String str) {
      return StringUtil.firstCharToLower(str);
   }
   /**
    * é¦–字母变大写
    *
    * @param str å­—符串
    * @return {String}
    */
   public static String firstCharToUpper(String str) {
      return StringUtil.firstCharToUpper(str);
   }
   /**
    * åˆ¤æ–­æ˜¯å¦ä¸ºç©ºå­—符串
    * <pre class="code">
    * $.isBlank(null)      = true
    * $.isBlank("")      = true
    * $.isBlank(" ")      = true
    * $.isBlank("12345")   = false
    * $.isBlank(" 12345 ")   = false
    * </pre>
    *
    * @param cs the {@code CharSequence} to check (may be {@code null})
    * @return {@code true} if the {@code CharSequence} is not {@code null},
    * its length is greater than 0, and it does not contain whitespace only
    * @see Character#isWhitespace
    */
   public static boolean isBlank(@Nullable final CharSequence cs) {
      return StringUtil.isBlank(cs);
   }
   /**
    * åˆ¤æ–­ä¸ä¸ºç©ºå­—符串
    * <pre>
    * $.isNotBlank(null)   = false
    * $.isNotBlank("")      = false
    * $.isNotBlank(" ")   = false
    * $.isNotBlank("bob")   = true
    * $.isNotBlank("  bob  ") = true
    * </pre>
    *
    * @param cs the CharSequence to check, may be null
    * @return {@code true} if the CharSequence is
    * not empty and not null and not whitespace
    * @see Character#isWhitespace
    */
   public static boolean isNotBlank(@Nullable final CharSequence cs) {
      return StringUtil.isNotBlank(cs);
   }
   /**
    * åˆ¤æ–­æ˜¯å¦æœ‰ä»»æ„ä¸€ä¸ª ç©ºå­—符串
    *
    * @param css CharSequence
    * @return boolean
    */
   public static boolean isAnyBlank(final CharSequence... css) {
      return StringUtil.isAnyBlank(css);
   }
   /**
    * åˆ¤æ–­æ˜¯å¦å…¨ä¸ºéžç©ºå­—符串
    *
    * @param css CharSequence
    * @return boolean
    */
   public static boolean isNoneBlank(final CharSequence... css) {
      return StringUtil.isNoneBlank(css);
   }
   /**
    * åˆ¤æ–­å¯¹è±¡æ˜¯æ•°ç»„
    *
    * @param obj the object to check
    * @return æ˜¯å¦æ•°ç»„
    */
   public static boolean isArray(@Nullable Object obj) {
      return ObjectUtil.isArray(obj);
   }
   /**
    * åˆ¤æ–­ç©ºå¯¹è±¡ object、map、list、set、字符串、数组
    *
    * @param obj the object to check
    * @return æ•°ç»„是否为空
    */
   public static boolean isEmpty(@Nullable Object obj) {
      return ObjectUtil.isEmpty(obj);
   }
   /**
    * å¯¹è±¡ä¸ä¸ºç©º object、map、list、set、字符串、数组
    *
    * @param obj the object to check
    * @return æ˜¯å¦ä¸ä¸ºç©º
    */
   public static boolean isNotEmpty(@Nullable Object obj) {
      return !ObjectUtil.isEmpty(obj);
   }
   /**
    * åˆ¤æ–­æ•°ç»„为空
    *
    * @param array the array to check
    * @return æ•°ç»„是否为空
    */
   public static boolean isEmpty(@Nullable Object[] array) {
      return ObjectUtil.isEmpty(array);
   }
   /**
    * åˆ¤æ–­æ•°ç»„不为空
    *
    * @param array æ•°ç»„
    * @return æ•°ç»„是否不为空
    */
   public static boolean isNotEmpty(@Nullable Object[] array) {
      return ObjectUtil.isNotEmpty(array);
   }
   /**
    * å¯¹è±¡ç»„中是否存在 Empty Object
    *
    * @param os å¯¹è±¡ç»„
    * @return boolean
    */
   public static boolean hasEmpty(Object... os) {
      for (Object o : os) {
         if (isEmpty(o)) {
            return true;
         }
      }
      return false;
   }
   /**
    * å¯¹è±¡ç»„中是否全部为 Empty Object
    *
    * @param os å¯¹è±¡ç»„
    * @return boolean
    */
   public static boolean isAllEmpty(Object... os) {
      for (Object o : os) {
         if (isNotEmpty(o)) {
            return false;
         }
      }
      return true;
   }
   /**
    * å°†å­—符串中特定模式的字符转换成map中对应的值
    * <p>
    * use: format("my name is ${name}, and i like ${like}!", {"name":"L.cm", "like": "Java"})
    *
    * @param message éœ€è¦è½¬æ¢çš„字符串
    * @param params  è½¬æ¢æ‰€éœ€çš„键值对集合
    * @return è½¬æ¢åŽçš„字符串
    */
   public static String format(@Nullable String message, @Nullable Map<String, ?> params) {
      return StringUtil.format(message, params);
   }
   /**
    * åŒ log æ ¼å¼çš„ format è§„则
    * <p>
    * use: format("my name is {}, and i like {}!", "L.cm", "Java")
    *
    * @param message   éœ€è¦è½¬æ¢çš„字符串
    * @param arguments éœ€è¦æ›¿æ¢çš„变量
    * @return è½¬æ¢åŽçš„字符串
    */
   public static String format(@Nullable String message, @Nullable Object... arguments) {
      return StringUtil.format(message, arguments);
   }
   /**
    * æ ¼å¼åŒ–执行时间,单位为 ms å’Œ s,保留三位小数
    *
    * @param nanos çº³ç§’
    * @return æ ¼å¼åŒ–后的时间
    */
   public static String format(long nanos) {
      return StringUtil.format(nanos);
   }
   /**
    * æ¯”较两个对象是否相等。<br>
    * ç›¸åŒçš„æ¡ä»¶æœ‰ä¸¤ä¸ªï¼Œæ»¡è¶³å…¶ä¸€å³å¯ï¼š<br>
    *
    * @param obj1 å¯¹è±¡1
    * @param obj2 å¯¹è±¡2
    * @return æ˜¯å¦ç›¸ç­‰
    */
   public static boolean equals(Object obj1, Object obj2) {
      return Objects.equals(obj1, obj2);
   }
   /**
    * å®‰å…¨çš„ equals
    *
    * @param o1 first Object to compare
    * @param o2 second Object to compare
    * @return whether the given objects are equal
    * @see Object#equals(Object)
    * @see java.util.Arrays#equals
    */
   public static boolean equalsSafe(@Nullable Object o1, @Nullable Object o2) {
      return ObjectUtil.nullSafeEquals(o1, o2);
   }
   /**
    * åˆ¤æ–­æ•°ç»„中是否包含元素
    *
    * @param array   the Array to check
    * @param element the element to look for
    * @param <T>     The generic tag
    * @return {@code true} if found, {@code false} else
    */
   public static <T> boolean contains(@Nullable T[] array, final T element) {
      return CollectionUtil.contains(array, element);
   }
   /**
    * åˆ¤æ–­è¿­ä»£å™¨ä¸­æ˜¯å¦åŒ…含元素
    *
    * @param iterator the Iterator to check
    * @param element  the element to look for
    * @return {@code true} if found, {@code false} otherwise
    */
   public static boolean contains(@Nullable Iterator<?> iterator, Object element) {
      return CollectionUtil.contains(iterator, element);
   }
   /**
    * åˆ¤æ–­æžšä¸¾æ˜¯å¦åŒ…含该元素
    *
    * @param enumeration the Enumeration to check
    * @param element     the element to look for
    * @return {@code true} if found, {@code false} otherwise
    */
   public static boolean contains(@Nullable Enumeration<?> enumeration, Object element) {
      return CollectionUtil.contains(enumeration, element);
   }
   /**
    * ä¸å¯å˜ Set
    *
    * @param es  å¯¹è±¡
    * @param <E> æ³›åž‹
    * @return é›†åˆ
    */
   @SafeVarargs
   public static <E> Set<E> ofImmutableSet(E... es) {
      return CollectionUtil.ofImmutableSet(es);
   }
   /**
    * ä¸å¯å˜ List
    *
    * @param es  å¯¹è±¡
    * @param <E> æ³›åž‹
    * @return é›†åˆ
    */
   @SafeVarargs
   public static <E> List<E> ofImmutableList(E... es) {
      return CollectionUtil.ofImmutableList(es);
   }
   /**
    * å¼ºè½¬string,并去掉多余空格
    *
    * @param str å­—符串
    * @return {String}
    */
   public static String toStr(Object str) {
      return toStr(str, "");
   }
   /**
    * å¼ºè½¬string,并去掉多余空格
    *
    * @param str          å­—符串
    * @param defaultValue é»˜è®¤å€¼
    * @return {String}
    */
   public static String toStr(Object str, String defaultValue) {
      if (null == str || str.equals(StringPool.NULL)) {
         return defaultValue;
      }
      return String.valueOf(str);
   }
   /**
    * å¼ºè½¬string(包含空字符串),并去掉多余空格
    *
    * @param str          å­—符串
    * @param defaultValue é»˜è®¤å€¼
    * @return {String}
    */
   public static String toStrWithEmpty(Object str, String defaultValue) {
      if (null == str || str.equals(StringPool.NULL) || str.equals(StringPool.EMPTY)) {
         return defaultValue;
      }
      return String.valueOf(str);
   }
   /**
    * åˆ¤æ–­ä¸€ä¸ªå­—符串是否是数字
    *
    * @param cs the CharSequence to check, may be null
    * @return {boolean}
    */
   public static boolean isNumeric(final CharSequence cs) {
      return StringUtil.isNumeric(cs);
   }
   /**
    * å­—符串转 int,为空则返回0
    *
    * <pre>
    *   $.toInt(null) = 0
    *   $.toInt("")   = 0
    *   $.toInt("1")  = 1
    * </pre>
    *
    * @param str the string to convert, may be null
    * @return the int represented by the string, or <code>zero</code> if
    * conversion fails
    */
   public static int toInt(final Object str) {
      return NumberUtil.toInt(String.valueOf(str));
   }
   /**
    * å­—符串转 int,为空则返回默认值
    *
    * <pre>
    *   $.toInt(null, 1) = 1
    *   $.toInt("", 1)   = 1
    *   $.toInt("1", 0)  = 1
    * </pre>
    *
    * @param str          the string to convert, may be null
    * @param defaultValue the default value
    * @return the int represented by the string, or the default if conversion fails
    */
   public static int toInt(@Nullable final Object str, final int defaultValue) {
      return NumberUtil.toInt(String.valueOf(str), defaultValue);
   }
   /**
    * å­—符串转 long,为空则返回0
    *
    * <pre>
    *   $.toLong(null) = 0L
    *   $.toLong("")   = 0L
    *   $.toLong("1")  = 1L
    * </pre>
    *
    * @param str the string to convert, may be null
    * @return the long represented by the string, or <code>0</code> if
    * conversion fails
    */
   public static long toLong(final Object str) {
      return NumberUtil.toLong(String.valueOf(str));
   }
   /**
    * å­—符串转 long,为空则返回默认值
    *
    * <pre>
    *   $.toLong(null, 1L) = 1L
    *   $.toLong("", 1L)   = 1L
    *   $.toLong("1", 0L)  = 1L
    * </pre>
    *
    * @param str          the string to convert, may be null
    * @param defaultValue the default value
    * @return the long represented by the string, or the default if conversion fails
    */
   public static long toLong(@Nullable final Object str, final long defaultValue) {
      return NumberUtil.toLong(String.valueOf(str), defaultValue);
   }
   /**
    * <p>Convert a <code>String</code> to an <code>Double</code>, returning a
    * default value if the conversion fails.</p>
    *
    * <p>If the string is <code>null</code>, the default value is returned.</p>
    *
    * <pre>
    *   $.toDouble(null, 1) = 1.0
    *   $.toDouble("", 1)   = 1.0
    *   $.toDouble("1", 0)  = 1.0
    * </pre>
    *
    * @param value the string to convert, may be null
    * @return the int represented by the string, or the default if conversion fails
    */
   public static Double toDouble(Object value) {
      return toDouble(String.valueOf(value), -1.00);
   }
   /**
    * <p>Convert a <code>String</code> to an <code>Double</code>, returning a
    * default value if the conversion fails.</p>
    *
    * <p>If the string is <code>null</code>, the default value is returned.</p>
    *
    * <pre>
    *   $.toDouble(null, 1) = 1.0
    *   $.toDouble("", 1)   = 1.0
    *   $.toDouble("1", 0)  = 1.0
    * </pre>
    *
    * @param value        the string to convert, may be null
    * @param defaultValue the default value
    * @return the int represented by the string, or the default if conversion fails
    */
   public static Double toDouble(Object value, Double defaultValue) {
      return NumberUtil.toDouble(String.valueOf(value), defaultValue);
   }
   /**
    * <p>Convert a <code>String</code> to an <code>Float</code>, returning a
    * default value if the conversion fails.</p>
    *
    * <p>If the string is <code>null</code>, the default value is returned.</p>
    *
    * <pre>
    *   $.toFloat(null, 1) = 1.00f
    *   $.toFloat("", 1)   = 1.00f
    *   $.toFloat("1", 0)  = 1.00f
    * </pre>
    *
    * @param value the string to convert, may be null
    * @return the int represented by the string, or the default if conversion fails
    */
   public static Float toFloat(Object value) {
      return toFloat(String.valueOf(value), -1.0f);
   }
   /**
    * <p>Convert a <code>String</code> to an <code>Float</code>, returning a
    * default value if the conversion fails.</p>
    *
    * <p>If the string is <code>null</code>, the default value is returned.</p>
    *
    * <pre>
    *   $.toFloat(null, 1) = 1.00f
    *   $.toFloat("", 1)   = 1.00f
    *   $.toFloat("1", 0)  = 1.00f
    * </pre>
    *
    * @param value        the string to convert, may be null
    * @param defaultValue the default value
    * @return the int represented by the string, or the default if conversion fails
    */
   public static Float toFloat(Object value, Float defaultValue) {
      return NumberUtil.toFloat(String.valueOf(value), defaultValue);
   }
   /**
    * <p>Convert a <code>String</code> to an <code>Boolean</code>, returning a
    * default value if the conversion fails.</p>
    *
    * <p>If the string is <code>null</code>, the default value is returned.</p>
    *
    * <pre>
    *   $.toBoolean("true", true)  = true
    *   $.toBoolean("false")      = false
    *   $.toBoolean("", false)     = false
    * </pre>
    *
    * @param value the string to convert, may be null
    * @return the int represented by the string, or the default if conversion fails
    */
   public static Boolean toBoolean(Object value) {
      return toBoolean(value, null);
   }
   /**
    * <p>Convert a <code>String</code> to an <code>Boolean</code>, returning a
    * default value if the conversion fails.</p>
    *
    * <p>If the string is <code>null</code>, the default value is returned.</p>
    *
    * <pre>
    *   $.toBoolean("true", true)  = true
    *   $.toBoolean("false")      = false
    *   $.toBoolean("", false)     = false
    * </pre>
    *
    * @param value        the string to convert, may be null
    * @param defaultValue the default value
    * @return the int represented by the string, or the default if conversion fails
    */
   public static Boolean toBoolean(Object value, Boolean defaultValue) {
      if (value != null) {
         String val = String.valueOf(value);
         val = val.toLowerCase().trim();
         return Boolean.parseBoolean(val);
      }
      return defaultValue;
   }
   /**
    * è½¬æ¢ä¸ºInteger数组<br>
    *
    * @param str è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Integer[] toIntArray(String str) {
      return toIntArray(",", str);
   }
   /**
    * è½¬æ¢ä¸ºInteger数组<br>
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Integer[] toIntArray(String split, String str) {
      if (StringUtil.isEmpty(str)) {
         return new Integer[]{};
      }
      String[] arr = str.split(split);
      final Integer[] ints = new Integer[arr.length];
      for (int i = 0; i < arr.length; i++) {
         final Integer v = toInt(arr[i], 0);
         ints[i] = v;
      }
      return ints;
   }
   /**
    * è½¬æ¢ä¸ºInteger集合<br>
    *
    * @param str ç»“果被转换的值
    * @return ç»“æžœ
    */
   public static List<Integer> toIntList(String str) {
      return Arrays.asList(toIntArray(str));
   }
   /**
    * è½¬æ¢ä¸ºInteger集合<br>
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static List<Integer> toIntList(String split, String str) {
      return Arrays.asList(toIntArray(split, str));
   }
   /**
    * èŽ·å–ç¬¬ä¸€ä½Integer数值
    *
    * @param str è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Integer firstInt(String str) {
      return firstInt(",", str);
   }
   /**
    * èŽ·å–ç¬¬ä¸€ä½Integer数值
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Integer firstInt(String split, String str) {
      List<Integer> ints = toIntList(split, str);
      if (isEmpty(ints)) {
         return null;
      } else {
         return ints.get(0);
      }
   }
   /**
    * è½¬æ¢ä¸ºLong数组<br>
    *
    * @param str è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Long[] toLongArray(String str) {
      return toLongArray(",", str);
   }
   /**
    * è½¬æ¢ä¸ºLong数组<br>
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Long[] toLongArray(String split, String str) {
      if (StringUtil.isEmpty(str)) {
         return new Long[]{};
      }
      String[] arr = str.split(split);
      final Long[] longs = new Long[arr.length];
      for (int i = 0; i < arr.length; i++) {
         final Long v = toLong(arr[i], 0);
         longs[i] = v;
      }
      return longs;
   }
   /**
    * è½¬æ¢ä¸ºLong集合<br>
    *
    * @param str ç»“果被转换的值
    * @return ç»“æžœ
    */
   public static List<Long> toLongList(String str) {
      return Arrays.asList(toLongArray(str));
   }
   /**
    * è½¬æ¢ä¸ºLong集合<br>
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static List<Long> toLongList(String split, String str) {
      return Arrays.asList(toLongArray(split, str));
   }
   /**
    * èŽ·å–ç¬¬ä¸€ä½Long数值
    *
    * @param str è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Long firstLong(String str) {
      return firstLong(",", str);
   }
   /**
    * èŽ·å–ç¬¬ä¸€ä½Long数值
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static Long firstLong(String split, String str) {
      List<Long> longs = toLongList(split, str);
      if (isEmpty(longs)) {
         return null;
      } else {
         return longs.get(0);
      }
   }
   /**
    * è½¬æ¢ä¸ºString数组<br>
    *
    * @param str è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static String[] toStrArray(String str) {
      return toStrArray(",", str);
   }
   /**
    * è½¬æ¢ä¸ºString数组<br>
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static String[] toStrArray(String split, String str) {
      if (isBlank(str)) {
         return new String[]{};
      }
      return str.split(split);
   }
   /**
    * è½¬æ¢ä¸ºString集合<br>
    *
    * @param str ç»“果被转换的值
    * @return ç»“æžœ
    */
   public static List<String> toStrList(String str) {
      return Arrays.asList(toStrArray(str));
   }
   /**
    * è½¬æ¢ä¸ºString集合<br>
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static List<String> toStrList(String split, String str) {
      return Arrays.asList(toStrArray(split, str));
   }
   /**
    * èŽ·å–ç¬¬ä¸€ä½String数值
    *
    * @param str è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static String firstStr(String str) {
      return firstStr(",", str);
   }
   /**
    * èŽ·å–ç¬¬ä¸€ä½String数值
    *
    * @param split åˆ†éš”符
    * @param str   è¢«è½¬æ¢çš„值
    * @return ç»“æžœ
    */
   public static String firstStr(String split, String str) {
      List<String> strs = toStrList(split, str);
      if (isEmpty(strs)) {
         return null;
      } else {
         return strs.get(0);
      }
   }
   /**
    * å°† long è½¬çŸ­å­—符串 ä¸º 62 è¿›åˆ¶
    *
    * @param num æ•°å­—
    * @return çŸ­å­—符串
    */
   public static String to62String(long num) {
      return NumberUtil.to62String(num);
   }
   /**
    * å°†é›†åˆæ‹¼æŽ¥æˆå­—符串,默认使用`,`拼接
    *
    * @param coll the {@code Collection} to convert
    * @return the delimited {@code String}
    */
   public static String join(Collection<?> coll) {
      return StringUtil.join(coll);
   }
   /**
    * å°†é›†åˆæ‹¼æŽ¥æˆå­—符串,默认指定分隔符
    *
    * @param coll  the {@code Collection} to convert
    * @param delim the delimiter to use (typically a ",")
    * @return the delimited {@code String}
    */
   public static String join(Collection<?> coll, String delim) {
      return StringUtil.join(coll, delim);
   }
   /**
    * å°†æ•°ç»„拼接成字符串,默认使用`,`拼接
    *
    * @param arr the array to display
    * @return the delimited {@code String}
    */
   public static String join(Object[] arr) {
      return StringUtil.join(arr);
   }
   /**
    * å°†æ•°ç»„拼接成字符串,默认指定分隔符
    *
    * @param arr   the array to display
    * @param delim the delimiter to use (typically a ",")
    * @return the delimited {@code String}
    */
   public static String join(Object[] arr, String delim) {
      return StringUtil.join(arr, delim);
   }
   /**
    * åˆ‡åˆ†å­—符串,不去除切分后每个元素两边的空白符,不去除空白项
    *
    * @param str       è¢«åˆ‡åˆ†çš„字符串
    * @param separator åˆ†éš”符字符
    * @return åˆ‡åˆ†åŽçš„集合
    */
   public static List<String> split(CharSequence str, char separator) {
      return StringUtil.split(str, separator, -1);
   }
   /**
    * åˆ‡åˆ†å­—符串,去除切分后每个元素两边的空白符,去除空白项
    *
    * @param str       è¢«åˆ‡åˆ†çš„字符串
    * @param separator åˆ†éš”符字符
    * @return åˆ‡åˆ†åŽçš„集合
    */
   public static List<String> splitTrim(CharSequence str, char separator) {
      return StringUtil.splitTrim(str, separator);
   }
   /**
    * åˆ‡åˆ†å­—符串,去除切分后每个元素两边的空白符,去除空白项
    *
    * @param str       è¢«åˆ‡åˆ†çš„字符串
    * @param separator åˆ†éš”符字符
    * @return åˆ‡åˆ†åŽçš„集合
    */
   public static List<String> splitTrim(CharSequence str, CharSequence separator) {
      return StringUtil.splitTrim(str, separator);
   }
   /**
    * åˆ†å‰² å­—符串
    *
    * @param str       å­—符串
    * @param delimiter åˆ†å‰²ç¬¦
    * @return å­—符串数组
    */
   public static String[] split(@Nullable String str, @Nullable String delimiter) {
      return StringUtil.delimitedListToStringArray(str, delimiter);
   }
   /**
    * åˆ†å‰² å­—符串 åˆ é™¤å¸¸è§ ç©ºç™½ç¬¦
    *
    * @param str       å­—符串
    * @param delimiter åˆ†å‰²ç¬¦
    * @return å­—符串数组
    */
   public static String[] splitTrim(@Nullable String str, @Nullable String delimiter) {
      return StringUtil.delimitedListToStringArray(str, delimiter, " \t\n\n\f");
   }
   /**
    * å­—符串是否符合指定的 è¡¨è¾¾å¼
    *
    * <p>
    * pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy"
    * </p>
    *
    * @param pattern è¡¨è¾¾å¼
    * @param str     å­—符串
    * @return æ˜¯å¦åŒ¹é…
    */
   public static boolean simpleMatch(@Nullable String pattern, @Nullable String str) {
      return PatternMatchUtils.simpleMatch(pattern, str);
   }
   /**
    * å­—符串是否符合指定的 è¡¨è¾¾å¼
    *
    * <p>
    * pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy"
    * </p>
    *
    * @param patterns è¡¨è¾¾å¼ æ•°ç»„
    * @param str      å­—符串
    * @return æ˜¯å¦åŒ¹é…
    */
   public static boolean simpleMatch(@Nullable String[] patterns, String str) {
      return PatternMatchUtils.simpleMatch(patterns, str);
   }
   /**
    * ç”Ÿæˆuuid
    *
    * @return UUID
    */
   public static String randomUUID() {
      return StringUtil.randomUUID();
   }
   /**
    * è½¬ä¹‰HTML用于安全过滤
    *
    * @param html html
    * @return {String}
    */
   public static String escapeHtml(String html) {
      return StringUtil.escapeHtml(html);
   }
   /**
    * éšæœºæ•°ç”Ÿæˆ
    *
    * @param count å­—符长度
    * @return éšæœºæ•°
    */
   public static String random(int count) {
      return StringUtil.random(count);
   }
   /**
    * éšæœºæ•°ç”Ÿæˆ
    *
    * @param count      å­—符长度
    * @param randomType éšæœºæ•°ç±»åˆ«
    * @return éšæœºæ•°
    */
   public static String random(int count, RandomType randomType) {
      return StringUtil.random(count, randomType);
   }
   /**
    * å­—符串序列化成 md5
    *
    * @param data Data to digest
    * @return MD5 digest as a hex string
    */
   public static String md5Hex(final String data) {
      return DigestUtil.md5Hex(data);
   }
   /**
    * æ•°ç»„序列化成 md5
    *
    * @param bytes the bytes to calculate the digest over
    * @return md5 digest string
    */
   public static String md5Hex(final byte[] bytes) {
      return DigestUtil.md5Hex(bytes);
   }
   /**
    * sha1Hex
    *
    * @param data Data to digest
    * @return digest as a hex string
    */
   public static String sha1Hex(String data) {
      return DigestUtil.sha1Hex(data);
   }
   /**
    * sha1Hex
    *
    * @param bytes Data to digest
    * @return digest as a hex string
    */
   public static String sha1Hex(final byte[] bytes) {
      return DigestUtil.sha1Hex(bytes);
   }
   /**
    * SHA224Hex
    *
    * @param data Data to digest
    * @return digest as a hex string
    */
   public static String sha224Hex(String data) {
      return DigestUtil.sha224Hex(data);
   }
   /**
    * SHA224Hex
    *
    * @param bytes Data to digest
    * @return digest as a hex string
    */
   public static String sha224Hex(final byte[] bytes) {
      return DigestUtil.sha224Hex(bytes);
   }
   /**
    * sha256Hex
    *
    * @param data Data to digest
    * @return digest as a hex string
    */
   public static String sha256Hex(String data) {
      return DigestUtil.sha256Hex(data);
   }
   /**
    * sha256Hex
    *
    * @param bytes Data to digest
    * @return digest as a hex string
    */
   public static String sha256Hex(final byte[] bytes) {
      return DigestUtil.sha256Hex(bytes);
   }
   /**
    * sha384Hex
    *
    * @param data Data to digest
    * @return digest as a hex string
    */
   public static String sha384Hex(String data) {
      return DigestUtil.sha384Hex(data);
   }
   /**
    * sha384Hex
    *
    * @param bytes Data to digest
    * @return digest as a hex string
    */
   public static String sha384Hex(final byte[] bytes) {
      return DigestUtil.sha384Hex(bytes);
   }
   /**
    * sha512Hex
    *
    * @param data Data to digest
    * @return digest as a hex string
    */
   public static String sha512Hex(String data) {
      return DigestUtil.sha512Hex(data);
   }
   /**
    * sha512Hex
    *
    * @param bytes Data to digest
    * @return digest as a hex string
    */
   public static String sha512Hex(final byte[] bytes) {
      return DigestUtil.sha512Hex(bytes);
   }
   /**
    * hmacMd5 Hex
    *
    * @param data Data to digest
    * @param key  key
    * @return digest as a hex string
    */
   public static String hmacMd5Hex(String data, String key) {
      return DigestUtil.hmacMd5Hex(data, key);
   }
   /**
    * hmacMd5 Hex
    *
    * @param bytes Data to digest
    * @param key   key
    * @return digest as a hex string
    */
   public static String hmacMd5Hex(final byte[] bytes, String key) {
      return DigestUtil.hmacMd5Hex(bytes, key);
   }
   /**
    * hmacSha1 Hex
    *
    * @param data Data to digest
    * @param key  key
    * @return digest as a hex string
    */
   public static String hmacSha1Hex(String data, String key) {
      return DigestUtil.hmacSha1Hex(data, key);
   }
   /**
    * hmacSha1 Hex
    *
    * @param bytes Data to digest
    * @param key   key
    * @return digest as a hex string
    */
   public static String hmacSha1Hex(final byte[] bytes, String key) {
      return DigestUtil.hmacSha1Hex(bytes, key);
   }
   /**
    * hmacSha224 Hex
    *
    * @param data Data to digest
    * @param key  key
    * @return digest as a hex string
    */
   public static String hmacSha224Hex(String data, String key) {
      return DigestUtil.hmacSha224Hex(data, key);
   }
   /**
    * hmacSha224 Hex
    *
    * @param bytes Data to digest
    * @param key   key
    * @return digest as a hex string
    */
   public static String hmacSha224Hex(final byte[] bytes, String key) {
      return DigestUtil.hmacSha224Hex(bytes, key);
   }
   /**
    * hmacSha256 Hex
    *
    * @param data Data to digest
    * @param key  key
    * @return digest as a hex string
    */
   public static String hmacSha256Hex(String data, String key) {
      return DigestUtil.hmacSha256Hex(data, key);
   }
   /**
    * hmacSha256 Hex
    *
    * @param bytes Data to digest
    * @param key   key
    * @return digest as a hex string
    */
   public static String hmacSha256Hex(final byte[] bytes, String key) {
      return DigestUtil.hmacSha256Hex(bytes, key);
   }
   /**
    * hmacSha384 Hex
    *
    * @param data Data to digest
    * @param key  key
    * @return digest as a hex string
    */
   public static String hmacSha384Hex(String data, String key) {
      return DigestUtil.hmacSha384Hex(data, key);
   }
   /**
    * hmacSha384 Hex
    *
    * @param bytes Data to digest
    * @param key   key
    * @return digest as a hex string
    */
   public static String hmacSha384Hex(final byte[] bytes, String key) {
      return DigestUtil.hmacSha384Hex(bytes, key);
   }
   /**
    * hmacSha512 Hex
    *
    * @param data Data to digest
    * @param key  key
    * @return digest as a hex string
    */
   public static String hmacSha512Hex(String data, String key) {
      return DigestUtil.hmacSha512Hex(data, key);
   }
   /**
    * hmacSha512 Hex
    *
    * @param bytes Data to digest
    * @param key   key
    * @return digest as a hex string
    */
   public static String hmacSha512Hex(final byte[] bytes, String key) {
      return DigestUtil.hmacSha512Hex(bytes, key);
   }
   /**
    * byte æ•°ç»„序列化成 hex
    *
    * @param bytes bytes to encode
    * @return MD5 digest as a hex string
    */
   public static String encodeHex(byte[] bytes) {
      return DigestUtil.encodeHex(bytes);
   }
   /**
    * å­—符串反序列化成 hex
    *
    * @param hexString String to decode
    * @return MD5 digest as a hex string
    */
   public static byte[] decodeHex(final String hexString) {
      return DigestUtil.decodeHex(hexString);
   }
   /**
    * Base64编码
    *
    * @param value å­—符串
    * @return {String}
    */
   public static String encodeBase64(String value) {
      return Base64Util.encode(value);
   }
   /**
    * Base64编码
    *
    * @param value   å­—符串
    * @param charset å­—符集
    * @return {String}
    */
   public static String encodeBase64(String value, Charset charset) {
      return Base64Util.encode(value, charset);
   }
   /**
    * Base64编码为URL安全
    *
    * @param value å­—符串
    * @return {String}
    */
   public static String encodeBase64UrlSafe(String value) {
      return Base64Util.encodeUrlSafe(value);
   }
   /**
    * Base64编码为URL安全
    *
    * @param value   å­—符串
    * @param charset å­—符集
    * @return {String}
    */
   public static String encodeBase64UrlSafe(String value, Charset charset) {
      return Base64Util.encodeUrlSafe(value, charset);
   }
   /**
    * Base64解码
    *
    * @param value å­—符串
    * @return {String}
    */
   public static String decodeBase64(String value) {
      return Base64Util.decode(value);
   }
   /**
    * Base64解码
    *
    * @param value   å­—符串
    * @param charset å­—符集
    * @return {String}
    */
   public static String decodeBase64(String value, Charset charset) {
      return Base64Util.decode(value, charset);
   }
   /**
    * Base64URL安全解码
    *
    * @param value å­—符串
    * @return {String}
    */
   public static String decodeBase64UrlSafe(String value) {
      return Base64Util.decodeUrlSafe(value);
   }
   /**
    * Base64URL安全解码
    *
    * @param value   å­—符串
    * @param charset å­—符集
    * @return {String}
    */
   public static String decodeBase64UrlSafe(String value, Charset charset) {
      return Base64Util.decodeUrlSafe(value, charset);
   }
   /**
    * å…³é—­ Closeable
    *
    * @param closeable è‡ªåЍ关闭
    */
   public static void closeQuietly(@Nullable Closeable closeable) {
      IoUtil.closeQuietly(closeable);
   }
   /**
    * InputStream to String utf-8
    *
    * @param input the <code>InputStream</code> to read from
    * @return the requested String
    * @throws NullPointerException if the input is null
    */
   public static String readToString(InputStream input) {
      return IoUtil.readToString(input);
   }
   /**
    * InputStream to String
    *
    * @param input   the <code>InputStream</code> to read from
    * @param charset the <code>Charset</code>
    * @return the requested String
    * @throws NullPointerException if the input is null
    */
   public static String readToString(@Nullable InputStream input, Charset charset) {
      return IoUtil.readToString(input, charset);
   }
   /**
    * InputStream to bytes æ•°ç»„
    *
    * @param input InputStream
    * @return the requested byte array
    */
   public static byte[] readToByteArray(@Nullable InputStream input) {
      return IoUtil.readToByteArray(input);
   }
   /**
    * è¯»å–文件为字符串
    *
    * @param file the file to read, must not be {@code null}
    * @return the file contents, never {@code null}
    */
   public static String readToString(final File file) {
      return FileUtil.readToString(file);
   }
   /**
    * è¯»å–文件为字符串
    *
    * @param file     the file to read, must not be {@code null}
    * @param encoding the encoding to use, {@code null} means platform default
    * @return the file contents, never {@code null}
    */
   public static String readToString(File file, Charset encoding) {
      return FileUtil.readToString(file, encoding);
   }
   /**
    * è¯»å–文件为 byte æ•°ç»„
    *
    * @param file the file to read, must not be {@code null}
    * @return the file contents, never {@code null}
    */
   public static byte[] readToByteArray(File file) {
      return FileUtil.readToByteArray(file);
   }
   /**
    * å°†å¯¹è±¡åºåˆ—化成json字符串
    *
    * @param object javaBean
    * @return jsonString json字符串
    */
   public static String toJson(Object object) {
      return JsonUtil.toJson(object);
   }
   /**
    * å°†å¯¹è±¡åºåˆ—化成 json byte æ•°ç»„
    *
    * @param object javaBean
    * @return jsonString json字符串
    */
   public static byte[] toJsonAsBytes(Object object) {
      return JsonUtil.toJsonAsBytes(object);
   }
   /**
    * å°†json字符串转成 JsonNode
    *
    * @param jsonString jsonString
    * @return jsonString json字符串
    */
   public static JsonNode readTree(String jsonString) {
      return JsonUtil.readTree(jsonString);
   }
   /**
    * å°†json字符串转成 JsonNode
    *
    * @param in InputStream
    * @return jsonString json字符串
    */
   public static JsonNode readTree(InputStream in) {
      return JsonUtil.readTree(in);
   }
   /**
    * å°†json字符串转成 JsonNode
    *
    * @param content content
    * @return jsonString json字符串
    */
   public static JsonNode readTree(byte[] content) {
      return JsonUtil.readTree(content);
   }
   /**
    * å°†json字符串转成 JsonNode
    *
    * @param jsonParser JsonParser
    * @return jsonString json字符串
    */
   public static JsonNode readTree(JsonParser jsonParser) {
      return JsonUtil.readTree(jsonParser);
   }
   /**
    * å°†json byte æ•°ç»„反序列化成对象
    *
    * @param bytes     json bytes
    * @param valueType class
    * @param <T>       T æ³›åž‹æ ‡è®°
    * @return Bean
    */
   public static <T> T readJson(byte[] bytes, Class<T> valueType) {
      return JsonUtil.parse(bytes, valueType);
   }
   /**
    * å°†json反序列化成对象
    *
    * @param jsonString jsonString
    * @param valueType  class
    * @param <T>        T æ³›åž‹æ ‡è®°
    * @return Bean
    */
   public static <T> T readJson(String jsonString, Class<T> valueType) {
      return JsonUtil.parse(jsonString, valueType);
   }
   /**
    * å°†json反序列化成对象
    *
    * @param in        InputStream
    * @param valueType class
    * @param <T>       T æ³›åž‹æ ‡è®°
    * @return Bean
    */
   public static <T> T readJson(InputStream in, Class<T> valueType) {
      return JsonUtil.parse(in, valueType);
   }
   /**
    * å°†json反序列化成对象
    *
    * @param bytes         bytes
    * @param typeReference æ³›åž‹ç±»åž‹
    * @param <T>           T æ³›åž‹æ ‡è®°
    * @return Bean
    */
   public static <T> T readJson(byte[] bytes, TypeReference<T> typeReference) {
      return JsonUtil.parse(bytes, typeReference);
   }
   /**
    * å°†json反序列化成对象
    *
    * @param jsonString    jsonString
    * @param typeReference æ³›åž‹ç±»åž‹
    * @param <T>           T æ³›åž‹æ ‡è®°
    * @return Bean
    */
   public static <T> T readJson(String jsonString, TypeReference<T> typeReference) {
      return JsonUtil.parse(jsonString, typeReference);
   }
   /**
    * å°†json反序列化成对象
    *
    * @param in            InputStream
    * @param typeReference æ³›åž‹ç±»åž‹
    * @param <T>           T æ³›åž‹æ ‡è®°
    * @return Bean
    */
   public static <T> T readJson(InputStream in, TypeReference<T> typeReference) {
      return JsonUtil.parse(in, typeReference);
   }
   /**
    * url ç¼–码
    *
    * @param source the String to be encoded
    * @return the encoded String
    */
   public static String urlEncode(String source) {
      return UrlUtil.encode(source, Charsets.UTF_8);
   }
   /**
    * url ç¼–码
    *
    * @param source  the String to be encoded
    * @param charset the character encoding to encode to
    * @return the encoded String
    */
   public static String urlEncode(String source, Charset charset) {
      return UrlUtil.encode(source, charset);
   }
   /**
    * url è§£ç 
    *
    * @param source the encoded String
    * @return the decoded value
    * @throws IllegalArgumentException when the given source contains invalid encoded sequences
    * @see StringUtils#uriDecode(String, Charset)
    * @see java.net.URLDecoder#decode(String, String)
    */
   public static String urlDecode(String source) {
      return StringUtils.uriDecode(source, Charsets.UTF_8);
   }
   /**
    * url è§£ç 
    *
    * @param source  the encoded String
    * @param charset the character encoding to use
    * @return the decoded value
    * @throws IllegalArgumentException when the given source contains invalid encoded sequences
    * @see StringUtils#uriDecode(String, Charset)
    * @see java.net.URLDecoder#decode(String, String)
    */
   public static String urlDecode(String source, Charset charset) {
      return StringUtils.uriDecode(source, charset);
   }
   /**
    * æ—¥æœŸæ—¶é—´æ ¼å¼åŒ–
    *
    * @param date æ—¶é—´
    * @return æ ¼å¼åŒ–后的时间
    */
   public static String formatDateTime(Date date) {
      return DateUtil.formatDateTime(date);
   }
   /**
    * æ—¥æœŸæ ¼å¼åŒ–
    *
    * @param date æ—¶é—´
    * @return æ ¼å¼åŒ–后的时间
    */
   public static String formatDate(Date date) {
      return DateUtil.formatDate(date);
   }
   /**
    * æ—¶é—´æ ¼å¼åŒ–
    *
    * @param date æ—¶é—´
    * @return æ ¼å¼åŒ–后的时间
    */
   public static String formatTime(Date date) {
      return DateUtil.formatTime(date);
   }
   /**
    * å¯¹è±¡æ ¼å¼åŒ– æ”¯æŒæ•°å­—,date,java8时间
    *
    * @param object  æ ¼å¼åŒ–对象
    * @param pattern è¡¨è¾¾å¼
    * @return æ ¼å¼åŒ–后的字符串
    */
   public static String format(Object object, String pattern) {
      if (object instanceof Number) {
         DecimalFormat decimalFormat = new DecimalFormat(pattern);
         return decimalFormat.format(object);
      } else if (object instanceof Date) {
         return DateUtil.format((Date) object, pattern);
      } else if (object instanceof TemporalAccessor) {
         return DateTimeUtil.format((TemporalAccessor) object, pattern);
      }
      throw new IllegalArgumentException("未支持的对象:" + object + ",格式:" + object);
   }
   /**
    * å°†å­—符串转换为时间
    *
    * @param dateStr æ—¶é—´å­—符串
    * @param pattern è¡¨è¾¾å¼
    * @return æ—¶é—´
    */
   public static Date parseDate(String dateStr, String pattern) {
      return DateUtil.parse(dateStr, pattern);
   }
   /**
    * å°†å­—符串转换为时间
    *
    * @param dateStr æ—¶é—´å­—符串
    * @param format  ConcurrentDateFormat
    * @return æ—¶é—´
    */
   public static Date parse(String dateStr, ConcurrentDateFormat format) {
      return DateUtil.parse(dateStr, format);
   }
   /**
    * æ—¥æœŸæ—¶é—´æ ¼å¼åŒ–
    *
    * @param temporal æ—¶é—´
    * @return æ ¼å¼åŒ–后的时间
    */
   public static String formatDateTime(TemporalAccessor temporal) {
      return DateTimeUtil.formatDateTime(temporal);
   }
   /**
    * æ—¥æœŸæ—¶é—´æ ¼å¼åŒ–
    *
    * @param temporal æ—¶é—´
    * @return æ ¼å¼åŒ–后的时间
    */
   public static String formatDate(TemporalAccessor temporal) {
      return DateTimeUtil.formatDate(temporal);
   }
   /**
    * æ—¶é—´æ ¼å¼åŒ–
    *
    * @param temporal æ—¶é—´
    * @return æ ¼å¼åŒ–后的时间
    */
   public static String formatTime(TemporalAccessor temporal) {
      return DateTimeUtil.formatTime(temporal);
   }
   /**
    * å°†å­—符串转换为时间
    *
    * @param dateStr   æ—¶é—´å­—符串
    * @param formatter DateTimeFormatter
    * @return æ—¶é—´
    */
   public static LocalDateTime parseDateTime(String dateStr, DateTimeFormatter formatter) {
      return DateTimeUtil.parseDateTime(dateStr, formatter);
   }
   /**
    * å°†å­—符串转换为时间
    *
    * @param dateStr æ—¶é—´å­—符串
    * @return æ—¶é—´
    */
   public static LocalDateTime parseDateTime(String dateStr) {
      return DateTimeUtil.parseDateTime(dateStr);
   }
   /**
    * å°†å­—符串转换为时间
    *
    * @param dateStr   æ—¶é—´å­—符串
    * @param formatter DateTimeFormatter
    * @return æ—¶é—´
    */
   public static LocalDate parseDate(String dateStr, DateTimeFormatter formatter) {
      return DateTimeUtil.parseDate(dateStr, formatter);
   }
   /**
    * å°†å­—符串转换为日期
    *
    * @param dateStr æ—¶é—´å­—符串
    * @return æ—¶é—´
    */
   public static LocalDate parseDate(String dateStr) {
      return DateTimeUtil.parseDate(dateStr, DateTimeUtil.DATE_FORMAT);
   }
   /**
    * å°†å­—符串转换为时间
    *
    * @param dateStr   æ—¶é—´å­—符串
    * @param formatter DateTimeFormatter
    * @return æ—¶é—´
    */
   public static LocalTime parseTime(String dateStr, DateTimeFormatter formatter) {
      return DateTimeUtil.parseTime(dateStr, formatter);
   }
   /**
    * å°†å­—符串转换为时间
    *
    * @param dateStr æ—¶é—´å­—符串
    * @return æ—¶é—´
    */
   public static LocalTime parseTime(String dateStr) {
      return DateTimeUtil.parseTime(dateStr);
   }
   /**
    * æ—¶é—´æ¯”较
    *
    * @param startInclusive the start instant, inclusive, not null
    * @param endExclusive   the end instant, exclusive, not null
    * @return a {@code Duration}, not null
    */
   public static Duration between(Temporal startInclusive, Temporal endExclusive) {
      return Duration.between(startInclusive, endExclusive);
   }
   /**
    * æ¯”较2个 æ—¶é—´å·®
    *
    * @param startDate å¼€å§‹æ—¶é—´
    * @param endDate   ç»“束时间
    * @return æ—¶é—´é—´éš”
    */
   public static Duration between(Date startDate, Date endDate) {
      return DateUtil.between(startDate, endDate);
   }
   /**
    * å¯¹è±¡ç±»åž‹è½¬æ¢
    *
    * @param source     the source object
    * @param targetType the target type
    * @param <T>        æ³›åž‹æ ‡è®°
    * @return the converted value
    * @throws IllegalArgumentException if targetType is {@code null},
    *                                  or sourceType is {@code null} but source is not {@code null}
    */
   @Nullable
   public static <T> T convert(@Nullable Object source, Class<T> targetType) {
      return ConvertUtil.convert(source, targetType);
   }
   /**
    * å¯¹è±¡ç±»åž‹è½¬æ¢
    *
    * @param source     the source object
    * @param sourceType the source type
    * @param targetType the target type
    * @param <T>        æ³›åž‹æ ‡è®°
    * @return the converted value
    * @throws IllegalArgumentException if targetType is {@code null},
    *                                  or sourceType is {@code null} but source is not {@code null}
    */
   @Nullable
   public static <T> T convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
      return ConvertUtil.convert(source, sourceType, targetType);
   }
   /**
    * å¯¹è±¡ç±»åž‹è½¬æ¢
    *
    * @param source     the source object
    * @param targetType the target type
    * @param <T>        æ³›åž‹æ ‡è®°
    * @return the converted value
    * @throws IllegalArgumentException if targetType is {@code null},
    *                                  or sourceType is {@code null} but source is not {@code null}
    */
   @Nullable
   public static <T> T convert(@Nullable Object source, TypeDescriptor targetType) {
      return ConvertUtil.convert(source, targetType);
   }
   /**
    * èŽ·å–æ–¹æ³•å‚æ•°ä¿¡æ¯
    *
    * @param constructor    æž„造器
    * @param parameterIndex å‚数序号
    * @return {MethodParameter}
    */
   public static MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
      return ClassUtil.getMethodParameter(constructor, parameterIndex);
   }
   /**
    * èŽ·å–æ–¹æ³•å‚æ•°ä¿¡æ¯
    *
    * @param method         æ–¹æ³•
    * @param parameterIndex å‚数序号
    * @return {MethodParameter}
    */
   public static MethodParameter getMethodParameter(Method method, int parameterIndex) {
      return ClassUtil.getMethodParameter(method, parameterIndex);
   }
   /**
    * èŽ·å–Annotation注解
    *
    * @param annotatedElement AnnotatedElement
    * @param annotationType   æ³¨è§£ç±»
    * @param <A>              æ³›åž‹æ ‡è®°
    * @return {Annotation}
    */
   @Nullable
   public static <A extends Annotation> A getAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType) {
      return AnnotatedElementUtils.findMergedAnnotation(annotatedElement, annotationType);
   }
   /**
    * èŽ·å–Annotation,先找方法,没有则再找方法上的类
    *
    * @param method         Method
    * @param annotationType æ³¨è§£ç±»
    * @param <A>            æ³›åž‹æ ‡è®°
    * @return {Annotation}
    */
   @Nullable
   public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
      return ClassUtil.getAnnotation(method, annotationType);
   }
   /**
    * èŽ·å–Annotation,先找HandlerMethod,没有则再找对应的类
    *
    * @param handlerMethod  HandlerMethod
    * @param annotationType æ³¨è§£ç±»
    * @param <A>            æ³›åž‹æ ‡è®°
    * @return {Annotation}
    */
   @Nullable
   public static <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
      return ClassUtil.getAnnotation(handlerMethod, annotationType);
   }
   /**
    * å®žä¾‹åŒ–对象
    *
    * @param clazz ç±»
    * @param <T>   æ³›åž‹æ ‡è®°
    * @return å¯¹è±¡
    */
   @SuppressWarnings("unchecked")
   public static <T> T newInstance(Class<?> clazz) {
      return (T) BeanUtil.instantiateClass(clazz);
   }
   /**
    * å®žä¾‹åŒ–对象
    *
    * @param clazzStr ç±»å
    * @param <T>      æ³›åž‹æ ‡è®°
    * @return å¯¹è±¡
    */
   public static <T> T newInstance(String clazzStr) {
      return BeanUtil.newInstance(clazzStr);
   }
   /**
    * èŽ·å–Bean的属性
    *
    * @param bean         bean
    * @param propertyName å±žæ€§å
    * @return å±žæ€§å€¼
    */
   @Nullable
   public static Object getProperty(@Nullable Object bean, String propertyName) {
      return BeanUtil.getProperty(bean, propertyName);
   }
   /**
    * è®¾ç½®Bean属性
    *
    * @param bean         bean
    * @param propertyName å±žæ€§å
    * @param value        å±žæ€§å€¼
    */
   public static void setProperty(Object bean, String propertyName, Object value) {
      BeanUtil.setProperty(bean, propertyName, value);
   }
   /**
    * æµ…复制
    *
    * @param source æºå¯¹è±¡
    * @param <T>    æ³›åž‹æ ‡è®°
    * @return T
    */
   @Nullable
   public static <T> T clone(@Nullable T source) {
      return BeanUtil.clone(source);
   }
   /**
    * æ‹·è´å¯¹è±¡ï¼Œæ”¯æŒ Map å’Œ Bean
    *
    * @param source æºå¯¹è±¡
    * @param clazz  ç±»å
    * @param <T>    æ³›åž‹æ ‡è®°
    * @return T
    */
   @Nullable
   public static <T> T copy(@Nullable Object source, Class<T> clazz) {
      return BeanUtil.copy(source, clazz);
   }
   /**
    * æ‹·è´å¯¹è±¡ï¼Œæ”¯æŒ Map å’Œ Bean
    *
    * @param source     æºå¯¹è±¡
    * @param targetBean éœ€è¦èµ‹å€¼çš„对象
    */
   public static void copy(@Nullable Object source, @Nullable Object targetBean) {
      BeanUtil.copy(source, targetBean);
   }
   /**
    * æ‹·è´å¯¹è±¡ï¼Œsource å¯¹è±¡å±žæ€§åšéž null åˆ¤æ–­
    *
    * <p>
    * æ”¯æŒ map bean copy
    * </p>
    *
    * @param source     æºå¯¹è±¡
    * @param targetBean éœ€è¦èµ‹å€¼çš„对象
    */
   public static void copyNonNull(@Nullable Object source, @Nullable Object targetBean) {
      BeanUtil.copyNonNull(source, targetBean);
   }
   /**
    * æ‹·è´å¯¹è±¡ï¼Œå¹¶å¯¹ä¸åŒç±»åž‹å±žæ€§è¿›è¡Œè½¬æ¢
    *
    * @param source æºå¯¹è±¡
    * @param clazz  ç±»å
    * @param <T>    æ³›åž‹æ ‡è®°
    * @return T
    */
   @Nullable
   public static <T> T copyWithConvert(@Nullable Object source, Class<T> clazz) {
      return BeanUtil.copyWithConvert(source, clazz);
   }
   /**
    * æ‹·è´åˆ—表对象
    *
    * <p>
    * æ”¯æŒ map bean copy
    * </p>
    *
    * @param sourceList  æºåˆ—表
    * @param targetClazz è½¬æ¢æˆçš„类型
    * @param <T>         æ³›åž‹æ ‡è®°
    * @return T
    */
   public static <T> List<T> copy(@Nullable Collection<?> sourceList, Class<T> targetClazz) {
      return BeanUtil.copy(sourceList, targetClazz);
   }
   /**
    * æ‹·è´åˆ—表对象,并对不同类型属性进行转换
    *
    * <p>
    * æ”¯æŒ map bean copy
    * </p>
    *
    * @param sourceList  æºå¯¹è±¡åˆ—表
    * @param targetClazz è½¬æ¢æˆçš„ç±»
    * @param <T>         æ³›åž‹æ ‡è®°
    * @return List
    */
   public static <T> List<T> copyWithConvert(@Nullable Collection<?> sourceList, Class<T> targetClazz) {
      return BeanUtil.copyWithConvert(sourceList, targetClazz);
   }
   /**
    * æ‹·è´å¯¹è±¡ï¼Œæ‰©å±• Spring çš„æ‹·è´æ–¹æ³•
    *
    * @param source the source bean
    * @param clazz  the target bean class
    * @param <T>    æ³›åž‹æ ‡è®°
    * @return T
    * @throws BeansException if the copying failed
    */
   @Nullable
   public static <T> T copyProperties(@Nullable Object source, Class<T> clazz) throws BeansException {
      return BeanUtil.copyProperties(source, clazz);
   }
   /**
    * æ‹·è´åˆ—表对象,扩展 Spring çš„æ‹·è´æ–¹æ³•
    *
    * @param sourceList  the source list bean
    * @param targetClazz the target bean class
    * @param <T>         æ³›åž‹æ ‡è®°
    * @return List
    * @throws BeansException if the copying failed
    */
   public static <T> List<T> copyProperties(@Nullable Collection<?> sourceList, Class<T> targetClazz) throws BeansException {
      return BeanUtil.copyProperties(sourceList, targetClazz);
   }
   /**
    * å°†å¯¹è±¡è£…成map形式
    *
    * @param bean æºå¯¹è±¡
    * @return {Map}
    */
   public static Map<String, Object> toMap(@Nullable Object bean) {
      return BeanUtil.toMap(bean);
   }
   /**
    * å°†map è½¬ä¸º bean
    *
    * @param beanMap   map
    * @param valueType å¯¹è±¡ç±»åž‹
    * @param <T>       æ³›åž‹æ ‡è®°
    * @return {T}
    */
   public static <T> T toBean(Map<String, Object> beanMap, Class<T> valueType) {
      return BeanUtil.toBean(beanMap, valueType);
   }
}