mica-core
中封装了大量的常用工具类,大部分都是基于Spring core进行扩展,避免重复造轮子,减少 bug
。
今天我们介绍的是 $
工具集快捷方式。在 jquery
中我们可以使用 $
进行各式各样的操作,而不用去记忆各种的工具类,能大幅度提高我们的开发效率。在工作中经常有同事问我,各种工具类有没有。受到启发,将工具类作为快捷方式的形式抽取到 $
中,减少学习开发成本。
类名:net.dreamlu.mica.core.utils.$
$.requireNotNull(Object obj);
$.requireNotNull(Object obj, String message);
$.requireNotNull(Object obj, Supplier messageSupplier);
$.isNull(Object obj);
$.notNull(Object obj);
$.firstCharToLower(String str);
$.firstCharToUpper(String str);
$.isBlank(CharSequence cs);
$.isNotBlank(CharSequence cs);
$.isAnyBlank(CharSequence... css);
$.isNoneBlank(CharSequence... css);
$.isArray(Object obj);
$.isEmpty(Object obj);
$.isNotEmpty(Object obj);
$.isEmpty(Object array);
$.isNotEmpty(Object[] array);
$.format(String message, Map<String, Object> params);
$.format(String message, Object... arguments);
$.equalsSafe(Object o1, Object o2);
$.contains(T[] array, T element);
$.contains(Iterator<?> iterator, Object element);
$.contains(Enumeration<?> enumeration, Object element);
$.ofImmutableSet(E... es);
$.ofImmutableList(E... es);
$.isNumeric(CharSequence cs);
$.toInt(String str);
$.toInt(String str, int defaultValue);
$.toLong(String str);
$.toLong(String str, long defaultValue);
$.to62String(long num);
,
拼接$.join(Collection<?> coll);
$.join(Collection<?> coll, String delim);
,
拼接$.join(Object[] arr);
$.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);
$.getUUID();
$.escapeHtml(String html);
$.random(int count);
$.random(int count, RandomType randomType);
$.md5Hex(String data);
$.md5Hex(byte[] bytes);
$.sha1Hex(String data);
$.sha1Hex(byte[] bytes);
$.sha224Hex(String data);
$.sha224Hex(byte[] bytes);
$.sha256Hex(String data);
$.sha256Hex(byte[] bytes);
$.sha384Hex(String data);
$.sha384Hex(byte[] bytes);
$.sha512Hex(String data);
$.sha512Hex(byte[] bytes);
$.hmacMd5Hex(String data, String key);
$.hmacMd5Hex(byte[] bytes, String key);
$.hmacSha1Hex(String data, String key);
$.hmacSha1Hex(byte[] bytes, String key);
$.hmacSha224Hex(String data, String key);
$.hmacSha224Hex(byte[] bytes, String key);
$.hmacSha256Hex(String data, String key);
$.hmacSha256Hex(byte[] bytes, String key);
$.hmacSha384Hex(String data, String key);
$.hmacSha384Hex(byte[] bytes, String key);
$.hmacSha512Hex(String data, String key);
$.hmacSha512Hex(byte[] bytes, String key);
$.encodeHex(byte[] bytes);
$.decodeHex(String hexString);
$.encodeBase64(String value);
$.encodeBase64(String value, Charset charset);
$.encodeBase64UrlSafe(String value);
$.encodeBase64UrlSafe(String value, Charset charset);
$.decodeBase64(String value);
$.decodeBase64(String value, Charset charset);
$.decodeBase64UrlSafe(String value);
$.decodeBase64UrlSafe(String value, Charset charset);
$.closeQuietly(Closeable closeable);
$.readToString(InputStream input);
$.readToString(InputStream input, Charset charset);
$.readToByteArray(InputStream input);
$.readToString(File file);
$.readToString(File file, Charset encoding);
$.readToByteArray(File file);
$.toJson(Object object);
$.toJsonAsBytes(Object object);
$.readTree(String jsonString);
$.readTree(InputStream in);
$.readTree(byte[] content);
$.readTree(JsonParser jsonParser);
$.readJson(byte[] bytes, Class<T> valueType);
$.readJson(String jsonString, Class<T> valueType);
$.readJson(InputStream in, Class<T> valueType);
$.readJson(byte[] bytes, TypeReference<?> typeReference);
$.readJson(String jsonString, TypeReference<?> typeReference);
$.readJson(InputStream in, TypeReference<?> typeReference);
$.urlEncode(String source);
$.urlEncode(String source, Charset charset);
$.urlDecode(String source);
$.urlDecode(String source, Charset charset);
$.formatDateTime(Date date);
$.formatDate(Date date);
$.formatTime(Date date);
$.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);
$.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);
$.getAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType);
$.getAnnotation(Method method, Class<A> annotationType);
$.getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType);
$.newInstance(Class<?> clazz);
$.newInstance(String clazzStr);
$.getProperty(Object bean, String propertyName);
$.setProperty(Object bean, String propertyName, Object value);
$.clone(Object source);
$.copy(Object source, Class<T> clazz);
$.copy(Object source, Object targetBean);
$.copyNonNull(Object source, Object targetBean);
$.copyWithConvert(Object source, Class<T> clazz);
$.copy(Collection sourceList, Class<T> targetClazz);
$.copyWithConvert(Collection sourceList, Class<T> targetClazz);
$.copyProperties(Object source, Class<T> clazz);
$.copyProperties(Collection sourceList, Class<T> targetClazz);
$.toMap(Object bean);
$.toBean(Map<String, Object> beanMap, Class<T> valueType);