mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
Merge pull request #1478 from cal101/jdt-RemoveAllTrailingWhitespaceCleanUp-2
[cleanup] erefactor/EclipseJdt - Remove trailing whitespace - All lines
This commit is contained in:
commit
a00066b1fa
@ -6,7 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
|
||||
/**
|
||||
* 字符转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@ import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 各种集合类转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 3.0.8
|
||||
*/
|
||||
@ -31,7 +31,7 @@ public class CollectionConverter implements Converter<Collection<?>> {
|
||||
// ---------------------------------------------------------------------------------------------- Constractor start
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
*
|
||||
* @param collectionType 集合类型
|
||||
*/
|
||||
public CollectionConverter(Type collectionType) {
|
||||
@ -40,7 +40,7 @@ public class CollectionConverter implements Converter<Collection<?>> {
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
*
|
||||
* @param collectionType 集合类型
|
||||
*/
|
||||
public CollectionConverter(Class<?> collectionType) {
|
||||
@ -49,7 +49,7 @@ public class CollectionConverter implements Converter<Collection<?>> {
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
*
|
||||
* @param collectionType 集合类型
|
||||
* @param elementType 集合元素类型
|
||||
*/
|
||||
@ -67,7 +67,7 @@ public class CollectionConverter implements Converter<Collection<?>> {
|
||||
|
||||
/**
|
||||
* 内部转换
|
||||
*
|
||||
*
|
||||
* @param value 值
|
||||
* @return 转换后的集合对象
|
||||
*/
|
||||
|
@ -6,7 +6,7 @@ import cn.hutool.core.convert.AbstractConverter;
|
||||
|
||||
/**
|
||||
* 货币{@link Currency} 转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 3.0.8
|
||||
*/
|
||||
|
@ -6,9 +6,9 @@ import java.time.Duration;
|
||||
import java.time.temporal.TemporalAmount;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* {@link Duration}对象转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 5.0.0
|
||||
*/
|
||||
|
@ -4,7 +4,7 @@ import cn.hutool.core.convert.AbstractConverter;
|
||||
|
||||
/**
|
||||
* 泛型枚举转换器
|
||||
*
|
||||
*
|
||||
* @param <E> 枚举类类型
|
||||
* @author Looly
|
||||
* @since 4.0.2
|
||||
@ -15,10 +15,10 @@ public class GenericEnumConverter<E extends Enum<E>> extends AbstractConverter<E
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Class<E> enumClass;
|
||||
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
*
|
||||
* @param enumClass 转换成的目标Enum类
|
||||
*/
|
||||
public GenericEnumConverter(Class<E> enumClass) {
|
||||
|
@ -6,10 +6,10 @@ import cn.hutool.core.convert.AbstractConverter;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* {@link Locale}对象转换器<br>
|
||||
* 只提供String转换支持
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 4.5.2
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* {@link Map} 转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 3.0.8
|
||||
*/
|
||||
@ -30,7 +30,7 @@ public class MapConverter extends AbstractConverter<Map<?, ?>> {
|
||||
|
||||
/**
|
||||
* 构造,Map的key和value泛型类型自动获取
|
||||
*
|
||||
*
|
||||
* @param mapType Map类型
|
||||
*/
|
||||
public MapConverter(Type mapType) {
|
||||
@ -39,7 +39,7 @@ public class MapConverter extends AbstractConverter<Map<?, ?>> {
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
*
|
||||
* @param mapType Map类型
|
||||
* @param keyType 键类型
|
||||
* @param valueType 值类型
|
||||
@ -77,7 +77,7 @@ public class MapConverter extends AbstractConverter<Map<?, ?>> {
|
||||
|
||||
/**
|
||||
* Map转Map
|
||||
*
|
||||
*
|
||||
* @param srcMap 源Map
|
||||
* @param targetMap 目标Map
|
||||
*/
|
||||
|
@ -5,9 +5,9 @@ import cn.hutool.core.convert.AbstractConverter;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* {@link Optional}对象转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 5.0.0
|
||||
*/
|
||||
|
@ -22,15 +22,15 @@ public class PathConverter extends AbstractConverter<Path>{
|
||||
if(value instanceof URI){
|
||||
return Paths.get((URI)value);
|
||||
}
|
||||
|
||||
|
||||
if(value instanceof URL){
|
||||
return Paths.get(((URL)value).toURI());
|
||||
}
|
||||
|
||||
|
||||
if(value instanceof File){
|
||||
return ((File)value).toPath();
|
||||
}
|
||||
|
||||
|
||||
return Paths.get(convertToStr(value));
|
||||
} catch (Exception e) {
|
||||
// Ignore Exception
|
||||
|
@ -6,9 +6,9 @@ import java.time.Period;
|
||||
import java.time.temporal.TemporalAmount;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* {@link Period}对象转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 5.0.0
|
||||
*/
|
||||
|
@ -12,16 +12,16 @@ import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* {@link Reference}转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 3.0.8
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class ReferenceConverter extends AbstractConverter<Reference> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private final Class<? extends Reference> targetType;
|
||||
|
||||
|
||||
/**
|
||||
* 构造
|
||||
* @param targetType {@link Reference}实现类型
|
||||
@ -33,7 +33,7 @@ public class ReferenceConverter extends AbstractConverter<Reference> {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Reference<?> convertInternal(Object value) {
|
||||
|
||||
|
||||
//尝试将值转换为Reference泛型的类型
|
||||
Object targetValue = null;
|
||||
final Type paramType = TypeUtil.getTypeArgument(targetType);
|
||||
@ -43,13 +43,13 @@ public class ReferenceConverter extends AbstractConverter<Reference> {
|
||||
if(null == targetValue){
|
||||
targetValue = value;
|
||||
}
|
||||
|
||||
|
||||
if(this.targetType == WeakReference.class){
|
||||
return new WeakReference(targetValue);
|
||||
}else if(this.targetType == SoftReference.class){
|
||||
return new SoftReference(targetValue);
|
||||
}
|
||||
|
||||
|
||||
throw new UnsupportedOperationException(StrUtil.format("Unsupport Reference type: {}", this.targetType.getName()));
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
/**
|
||||
* {@link StackTraceElement} 转换器<br>
|
||||
* 只支持Map方式转换
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 3.0.8
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ public class URIConverter extends AbstractConverter<URI>{
|
||||
if(value instanceof File){
|
||||
return ((File)value).toURI();
|
||||
}
|
||||
|
||||
|
||||
if(value instanceof URL){
|
||||
return ((URL)value).toURI();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class URLConverter extends AbstractConverter<URL>{
|
||||
if(value instanceof File){
|
||||
return ((File)value).toURI().toURL();
|
||||
}
|
||||
|
||||
|
||||
if(value instanceof URI){
|
||||
return ((URI)value).toURL();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import cn.hutool.core.convert.AbstractConverter;
|
||||
|
||||
/**
|
||||
* UUID对象转换器转换器
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
* @since 4.0.10
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 各种类型转换的实现类,其都为Converter接口的实现,用于将未知的Object类型转换为指定类型
|
||||
*
|
||||
*
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 万能类型转换器以及各种类型转换的实现类,其中Convert为转换器入口,提供各种toXXX方法和convert方法
|
||||
*
|
||||
*
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日期间隔
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
@ -23,7 +23,7 @@ public class DateBetween implements Serializable{
|
||||
/**
|
||||
* 创建<br>
|
||||
* 在前的日期做为起始时间,在后的做为结束时间,间隔只保留绝对值正数
|
||||
*
|
||||
*
|
||||
* @param begin 起始时间
|
||||
* @param end 结束时间
|
||||
* @return DateBetween
|
||||
@ -36,7 +36,7 @@ public class DateBetween implements Serializable{
|
||||
/**
|
||||
* 创建<br>
|
||||
* 在前的日期做为起始时间,在后的做为结束时间,间隔只保留绝对值正数
|
||||
*
|
||||
*
|
||||
* @param begin 起始时间
|
||||
* @param end 结束时间
|
||||
* @param isAbs 日期间隔是否只保留绝对值正数
|
||||
@ -50,7 +50,7 @@ public class DateBetween implements Serializable{
|
||||
/**
|
||||
* 构造<br>
|
||||
* 在前的日期做为起始时间,在后的做为结束时间,间隔只保留绝对值正数
|
||||
*
|
||||
*
|
||||
* @param begin 起始时间
|
||||
* @param end 结束时间
|
||||
*/
|
||||
@ -61,7 +61,7 @@ public class DateBetween implements Serializable{
|
||||
/**
|
||||
* 构造<br>
|
||||
* 在前的日期做为起始时间,在后的做为结束时间
|
||||
*
|
||||
*
|
||||
* @param begin 起始时间
|
||||
* @param end 结束时间
|
||||
* @param isAbs 日期间隔是否只保留绝对值正数
|
||||
@ -70,7 +70,7 @@ public class DateBetween implements Serializable{
|
||||
public DateBetween(Date begin, Date end, boolean isAbs) {
|
||||
Assert.notNull(begin, "Begin date is null !");
|
||||
Assert.notNull(end, "End date is null !");
|
||||
|
||||
|
||||
if (isAbs && begin.after(end)) {
|
||||
// 间隔只为正数的情况下,如果开始日期晚于结束日期,置换之
|
||||
this.begin = end;
|
||||
@ -84,7 +84,7 @@ public class DateBetween implements Serializable{
|
||||
/**
|
||||
* 判断两个日期相差的时长<br>
|
||||
* 返回 给定单位的时长差
|
||||
*
|
||||
*
|
||||
* @param unit 相差的单位:相差 天{@link DateUnit#DAY}、小时{@link DateUnit#HOUR} 等
|
||||
* @return 时长差
|
||||
*/
|
||||
@ -96,7 +96,7 @@ public class DateBetween implements Serializable{
|
||||
/**
|
||||
* 计算两个日期相差月数<br>
|
||||
* 在非重置情况下,如果起始日期的天大于结束日期的天,月数要少算1(不足1个月)
|
||||
*
|
||||
*
|
||||
* @param isReset 是否重置时间为起始时间(重置天时分秒)
|
||||
* @return 相差月数
|
||||
* @since 3.0.8
|
||||
@ -123,7 +123,7 @@ public class DateBetween implements Serializable{
|
||||
/**
|
||||
* 计算两个日期相差年数<br>
|
||||
* 在非重置情况下,如果起始日期的月大于结束日期的月,年数要少算1(不足1年)
|
||||
*
|
||||
*
|
||||
* @param isReset 是否重置时间为起始时间(重置月天时分秒)
|
||||
* @return 相差年数
|
||||
* @since 3.0.8
|
||||
@ -155,7 +155,7 @@ public class DateBetween implements Serializable{
|
||||
|
||||
/**
|
||||
* 格式化输出时间差<br>
|
||||
*
|
||||
*
|
||||
* @param level 级别
|
||||
* @return 字符串
|
||||
*/
|
||||
|
@ -13,19 +13,19 @@ public class DateException extends RuntimeException{
|
||||
public DateException(Throwable e) {
|
||||
super(ExceptionUtil.getMessage(e), e);
|
||||
}
|
||||
|
||||
|
||||
public DateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
public DateException(String messageTemplate, Object... params) {
|
||||
super(StrUtil.format(messageTemplate, params));
|
||||
}
|
||||
|
||||
|
||||
public DateException(String message, Throwable throwable) {
|
||||
super(message, throwable);
|
||||
}
|
||||
|
||||
|
||||
public DateException(Throwable throwable, String messageTemplate, Object... params) {
|
||||
super(StrUtil.format(messageTemplate, params), throwable);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import java.util.Calendar;
|
||||
/**
|
||||
* 日期各个部分的枚举<br>
|
||||
* 与Calendar相应值对应
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
@ -13,91 +13,91 @@ public enum DateField {
|
||||
|
||||
/**
|
||||
* 世纪
|
||||
*
|
||||
*
|
||||
* @see Calendar#ERA
|
||||
*/
|
||||
ERA(Calendar.ERA),
|
||||
/**
|
||||
* 年
|
||||
*
|
||||
*
|
||||
* @see Calendar#YEAR
|
||||
*/
|
||||
YEAR(Calendar.YEAR),
|
||||
/**
|
||||
* 月
|
||||
*
|
||||
*
|
||||
* @see Calendar#MONTH
|
||||
*/
|
||||
MONTH(Calendar.MONTH),
|
||||
/**
|
||||
* 一年中第几周
|
||||
*
|
||||
*
|
||||
* @see Calendar#WEEK_OF_YEAR
|
||||
*/
|
||||
WEEK_OF_YEAR(Calendar.WEEK_OF_YEAR),
|
||||
/**
|
||||
* 一月中第几周
|
||||
*
|
||||
*
|
||||
* @see Calendar#WEEK_OF_MONTH
|
||||
*/
|
||||
WEEK_OF_MONTH(Calendar.WEEK_OF_MONTH),
|
||||
/**
|
||||
* 一月中的第几天
|
||||
*
|
||||
*
|
||||
* @see Calendar#DAY_OF_MONTH
|
||||
*/
|
||||
DAY_OF_MONTH(Calendar.DAY_OF_MONTH),
|
||||
/**
|
||||
* 一年中的第几天
|
||||
*
|
||||
*
|
||||
* @see Calendar#DAY_OF_YEAR
|
||||
*/
|
||||
DAY_OF_YEAR(Calendar.DAY_OF_YEAR),
|
||||
/**
|
||||
* 周几,1表示周日,2表示周一
|
||||
*
|
||||
*
|
||||
* @see Calendar#DAY_OF_WEEK
|
||||
*/
|
||||
DAY_OF_WEEK(Calendar.DAY_OF_WEEK),
|
||||
/**
|
||||
* 天所在的周是这个月的第几周
|
||||
*
|
||||
*
|
||||
* @see Calendar#DAY_OF_WEEK_IN_MONTH
|
||||
*/
|
||||
DAY_OF_WEEK_IN_MONTH(Calendar.DAY_OF_WEEK_IN_MONTH),
|
||||
/**
|
||||
* 上午或者下午
|
||||
*
|
||||
*
|
||||
* @see Calendar#AM_PM
|
||||
*/
|
||||
AM_PM(Calendar.AM_PM),
|
||||
/**
|
||||
* 小时,用于12小时制
|
||||
*
|
||||
*
|
||||
* @see Calendar#HOUR
|
||||
*/
|
||||
HOUR(Calendar.HOUR),
|
||||
/**
|
||||
* 小时,用于24小时制
|
||||
*
|
||||
*
|
||||
* @see Calendar#HOUR
|
||||
*/
|
||||
HOUR_OF_DAY(Calendar.HOUR_OF_DAY),
|
||||
/**
|
||||
* 分钟
|
||||
*
|
||||
*
|
||||
* @see Calendar#MINUTE
|
||||
*/
|
||||
MINUTE(Calendar.MINUTE),
|
||||
/**
|
||||
* 秒
|
||||
*
|
||||
*
|
||||
* @see Calendar#SECOND
|
||||
*/
|
||||
SECOND(Calendar.SECOND),
|
||||
/**
|
||||
* 毫秒
|
||||
*
|
||||
*
|
||||
* @see Calendar#MILLISECOND
|
||||
*/
|
||||
MILLISECOND(Calendar.MILLISECOND);
|
||||
@ -115,7 +115,7 @@ public enum DateField {
|
||||
|
||||
/**
|
||||
* 将 {@link Calendar}相关值转换为DatePart枚举对象<br>
|
||||
*
|
||||
*
|
||||
* @param calendarPartIntValue Calendar中关于Week的int值
|
||||
* @return {@link DateField}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user