类名:net.dreamlu.mica.core.utils.$
断言,必须不能为 null
$.requireNotNull(Object obj);
|
断言,必须不能为 null
$.requireNotNull(Object obj, String message);
|
断言,必须不能为 null
$.requireNotNull(Object obj, Supplier messageSupplier);
|
判断对象是否为null
判断对象是否 not null
首字母变小写
$.firstCharToLower(String str);
|
首字母变大写
$.firstCharToUpper(String str);
|
判断是否为空字符串
$.isBlank(CharSequence cs);
|
判断不为空字符串
$.isNotBlank(CharSequence cs);
|
判断是否有任意一个 空字符串
$.isAnyBlank(CharSequence... css);
|
判断是否全为非空字符串
$.isNoneBlank(CharSequence... css);
|
判断对象是数组
判断空对象 object、map、list、set、字符串、数组
对象不为空 object、map、list、set、字符串、数组
$.isNotEmpty(Object obj);
|
判断数组为空
判断数组不为空
$.isNotEmpty(Object[] array);
|
将字符串中特定模式的字符转换成map中对应的值
$.format(String message, Map<String, Object> params);
|
同 log 格式的 format 规则
$.format(String message, Object... arguments);
|
安全的 equals
$.equalsSafe(Object o1, Object o2);
|
判断数组中是否包含元素
$.contains(T[] array, T element);
|
判断迭代器中是否包含元素
$.contains(Iterator<?> iterator, Object element);
|
判断枚举是否包含该元素
$.contains(Enumeration<?> enumeration, Object element);
|
不可变 Set
$.ofImmutableSet(E... es);
|
不可变 List
$.ofImmutableList(E... es);
|
判断一个字符串是否是数字
$.isNumeric(CharSequence cs);
|
字符串转 int,为空则返回0
字符串转 int,为空则返回默认值
$.toInt(String str, int defaultValue);
|
字符串转 long,为空则返回0
字符串转 long,为空则返回默认值
$.toLong(String str, long defaultValue);
|
将 long 转短字符串 为 62 进制
将集合拼接成字符串,默认使用,
拼接
$.join(Collection<?> coll);
|
将集合拼接成字符串,默认指定分隔符
$.join(Collection<?> coll, String delim);
|
将数组拼接成字符串,默认使用,
拼接
将数组拼接成字符串,默认指定分隔符
$.join(Object[] arr, String delim);
|
分割 字符串
$.split(String str, String delimiter);
|
分割 字符串 删除常见 空白符
$.splitTrim(String str, String delimiter);
|
字符串是否符合指定的 表达式
$.simpleMatch(String pattern, String str);
|
字符串是否符合指定的 表达式
$.simpleMatch(String[] patterns, String str);
|
生成uuid
转义HTML用于安全过滤
$.escapeHtml(String html);
|
随机数生成
随机数生成
$.random(int count, RandomType randomType);
|
字符串序列化成 md5
数组序列化成 md5
sha1Hex
sha1Hex
SHA224Hex
$.sha224Hex(String data);
|
SHA224Hex
$.sha224Hex(byte[] bytes);
|
sha256Hex
$.sha256Hex(String data);
|
sha256Hex
$.sha256Hex(byte[] bytes);
|
sha384Hex
$.sha384Hex(String data);
|
sha384Hex
$.sha384Hex(byte[] bytes);
|
sha512Hex
$.sha512Hex(String data);
|
sha512Hex
$.sha512Hex(byte[] bytes);
|
hmacMd5 Hex
$.hmacMd5Hex(String data, String key);
|
hmacMd5 Hex
$.hmacMd5Hex(byte[] bytes, String key);
|
hmacSha1 Hex
$.hmacSha1Hex(String data, String key);
|
hmacSha1 Hex
$.hmacSha1Hex(byte[] bytes, String key);
|
hmacSha224 Hex
$.hmacSha224Hex(String data, String key);
|
hmacSha224 Hex
$.hmacSha224Hex(byte[] bytes, String key);
|
hmacSha256 Hex
$.hmacSha256Hex(String data, String key);
|
hmacSha256 Hex
$.hmacSha256Hex(byte[] bytes, String key);
|
hmacSha384 Hex
$.hmacSha384Hex(String data, String key);
|
hmacSha384 Hex
$.hmacSha384Hex(byte[] bytes, String key);
|
hmacSha512 Hex
$.hmacSha512Hex(String data, String key);
|
hmacSha512 Hex
$.hmacSha512Hex(byte[] bytes, String key);
|
byte 数组序列化成 hex
$.encodeHex(byte[] bytes);
|
字符串反序列化成 hex
$.decodeHex(String hexString);
|
Base64编码
$.encodeBase64(String value);
|
Base64编码
$.encodeBase64(String value, Charset charset);
|
Base64编码为URL安全
$.encodeBase64UrlSafe(String value);
|
Base64编码为URL安全
$.encodeBase64UrlSafe(String value, Charset charset);
|
Base64解码
$.decodeBase64(String value);
|
Base64解码
$.decodeBase64(String value, Charset charset);
|
Base64URL安全解码
$.decodeBase64UrlSafe(String value);
|
Base64URL安全解码
$.decodeBase64UrlSafe(String value, Charset charset);
|
关闭 Closeable
$.closeQuietly(Closeable closeable);
|
InputStream to String utf-8
$.readToString(InputStream input);
|
InputStream to String
$.readToString(InputStream input, Charset charset);
|
InputStream to bytes 数组
$.readToByteArray(InputStream input);
|
读取文件为字符串
$.readToString(File file);
|
读取文件为字符串
$.readToString(File file, Charset encoding);
|
读取文件为 byte 数组
$.readToByteArray(File file);
|
将对象序列化成json字符串
将对象序列化成 json byte 数组
$.toJsonAsBytes(Object object);
|
将json字符串转成 JsonNode
$.readTree(String jsonString);
|
将json字符串转成 JsonNode
$.readTree(InputStream in);
|
将json字符串转成 JsonNode
$.readTree(byte[] content);
|
将json字符串转成 JsonNode
$.readTree(JsonParser jsonParser);
|
将json byte 数组反序列化成对象
$.readJson(byte[] bytes, Class<T> valueType);
|
将json反序列化成对象
$.readJson(String jsonString, Class<T> valueType);
|
将json反序列化成对象
$.readJson(InputStream in, Class<T> valueType);
|
将json反序列化成对象
$.readJson(byte[] bytes, TypeReference<?> typeReference);
|
将json反序列化成对象
$.readJson(String jsonString, TypeReference<?> typeReference);
|
将json反序列化成对象
$.readJson(InputStream in, TypeReference<?> typeReference);
|
url 编码
$.urlEncode(String source);
|
url 编码
$.urlEncode(String source, Charset charset);
|
url 解码
$.urlDecode(String source);
|
url 解码
$.urlDecode(String source, Charset charset);
|
日期时间格式化
$.formatDateTime(Date date);
|
日期格式化
时间格式化
对象格式化 支持数字,date,java8时间
$.format(Object object, String pattern);
|
将字符串转换为时间
$.parseDate(String dateStr, String pattern);
|
将字符串转换为时间
$.parse(String dateStr, ConcurrentDateFormat format);
|
日期时间格式化
$.formatDateTime(TemporalAccessor temporal);
|
日期时间格式化
$.formatDate(TemporalAccessor temporal);
|
时间格式化
$.formatTime(TemporalAccessor temporal);
|
将字符串转换为时间
$.parseDateTime(String dateStr, DateTimeFormatter formatter);
|
将字符串转换为时间
$.parseDateTime(String dateStr);
|
将字符串转换为时间
$.parseDate(String dateStr, DateTimeFormatter formatter);
|
将字符串转换为日期
$.parseDate(String dateStr);
|
将字符串转换为时间
$.parseTime(String dateStr, DateTimeFormatter formatter);
|
将字符串转换为时间
$.parseTime(String dateStr);
|
时间比较
$.between(Temporal startInclusive, Temporal endExclusive);
|
比较2个 时间差
$.between(Date startDate, Date endDate);
|
对象类型转换
$.convert(Object source, Class<T> targetType);
|
对象类型转换
$.convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType);
|
对象类型转换
$.convert(Object source, TypeDescriptor targetType);
|
获取方法参数信息
$.getMethodParameter(Constructor<?> constructor, int parameterIndex);
|
获取方法参数信息
$.getMethodParameter(Method method, int parameterIndex);
|
获取Annotation注解
$.getAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType);
|
获取Annotation,先找方法,没有则再找方法上的类
$.getAnnotation(Method method, Class<A> annotationType);
|
获取Annotation,先找HandlerMethod,没有则再找对应的类
$.getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType);
|
实例化对象
$.newInstance(Class<?> clazz);
|
实例化对象
$.newInstance(String clazzStr);
|
获取Bean的属性, 支持 propertyName 多级 :test.user.name
$.getProperty(Object bean, String propertyName);
|
设置Bean属性, 支持 propertyName 多级 :test.user.name
$.setProperty(Object bean, String propertyName, Object value);
|
浅复制
拷贝对象,支持 Map 和 Bean
$.copy(Object source, Class<T> clazz);
|
拷贝对象,支持 Map 和 Bean
$.copy(Object source, Object targetBean);
|
拷贝对象,source 对象属性做非 null 判断
$.copyNonNull(Object source, Object targetBean);
|
拷贝对象,并对不同类型属性进行转换
$.copyWithConvert(Object source, Class<T> clazz);
|
拷贝列表对象
$.copy(Collection sourceList, Class<T> targetClazz);
|
拷贝列表对象,并对不同类型属性进行转换
$.copyWithConvert(Collection sourceList, Class<T> targetClazz);
|
拷贝对象,扩展 Spring 的拷贝方法
$.copyProperties(Object source, Class<T> clazz);
|
拷贝列表对象,扩展 Spring 的拷贝方法
$.copyProperties(Collection sourceList, Class<T> targetClazz);
|
将对象装成map形式
将map 转为 bean
$.toBean(Map<String, Object> beanMap, Class<T> valueType);
|
微信公众号

精彩内容每日推荐!!!