mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
d2e5155ac5
commit
a96a95c988
@ -18,7 +18,7 @@
|
||||
# 2. 替换README.md和docs中的版本号
|
||||
#------------------------------------------------
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
if [ !-n "$1" ]; then
|
||||
echo "ERROR: 新版本不存在,请指定参数1"
|
||||
exit
|
||||
fi
|
||||
|
@ -61,7 +61,7 @@ public class Hutool {
|
||||
*/
|
||||
public static Set<Class<?>> getAllUtils() {
|
||||
return ClassUtil.scanPackage("org.dromara.hutool",
|
||||
(clazz) -> (! clazz.isInterface()) && StrUtil.endWith(clazz.getSimpleName(), "Util"));
|
||||
(clazz) -> (!clazz.isInterface()) && StrUtil.endWith(clazz.getSimpleName(), "Util"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ public class AnnotationProxy<T extends Annotation> implements Annotation, Invoca
|
||||
if(null != alias){
|
||||
final String name = alias.value();
|
||||
if(StrUtil.isNotBlank(name)){
|
||||
if(! attributes.containsKey(name)){
|
||||
if(!attributes.containsKey(name)){
|
||||
throw new IllegalArgumentException(StrUtil.format("No method for alias: [{}]", name));
|
||||
}
|
||||
return attributes.get(name);
|
||||
|
@ -253,9 +253,9 @@ public class AnnotationUtil {
|
||||
// 只读取无参方法
|
||||
final String name = t.getName();
|
||||
// 跳过自有的几个方法
|
||||
return (! "hashCode".equals(name)) //
|
||||
&& (! "toString".equals(name)) //
|
||||
&& (! "annotationType".equals(name));
|
||||
return (!"hashCode".equals(name)) //
|
||||
&& (!"toString".equals(name)) //
|
||||
&& (!"annotationType".equals(name));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
@ -146,9 +146,9 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
|
||||
// 直接注解
|
||||
for (final Annotation annotation : annotations) {
|
||||
annotationType = annotation.annotationType();
|
||||
if (! META_ANNOTATIONS.contains(annotationType)
|
||||
if (!META_ANNOTATIONS.contains(annotationType)
|
||||
// issue#I5FQGW@Gitee:跳过元注解和已经处理过的注解,防止递归调用
|
||||
&& ! declaredAnnotationMap.containsKey(annotationType)) {
|
||||
&& !declaredAnnotationMap.containsKey(annotationType)) {
|
||||
if(test(annotation)){
|
||||
declaredAnnotationMap.put(annotationType, annotation);
|
||||
}
|
||||
@ -167,9 +167,9 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
|
||||
Class<? extends Annotation> annotationType;
|
||||
for (final Annotation annotation : annotations) {
|
||||
annotationType = annotation.annotationType();
|
||||
if (! META_ANNOTATIONS.contains(annotationType)
|
||||
if (!META_ANNOTATIONS.contains(annotationType)
|
||||
// issue#I5FQGW@Gitee:跳过元注解和已经处理过的注解,防止递归调用
|
||||
&& ! declaredAnnotationMap.containsKey(annotationType)) {
|
||||
&& !declaredAnnotationMap.containsKey(annotationType)) {
|
||||
if(test(annotation)){
|
||||
annotationMap.put(annotationType, annotation);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
if (null == arrayObj) {
|
||||
throw new NullPointerException("Argument [arrayObj] is null !");
|
||||
}
|
||||
if (! arrayObj.getClass().isArray()) {
|
||||
if (!arrayObj.getClass().isArray()) {
|
||||
throw new IllegalArgumentException("Argument [arrayObj] is not array !");
|
||||
}
|
||||
if (null == type) {
|
||||
@ -1015,7 +1015,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> boolean containsAll(final T[] array, final T... values) {
|
||||
for (final T value : values) {
|
||||
if (! contains(array, value)) {
|
||||
if (!contains(array, value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1313,7 +1313,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
if (null == array) {
|
||||
return null;
|
||||
}
|
||||
if (! isArray(array)) {
|
||||
if (!isArray(array)) {
|
||||
throw new IllegalArgumentException(StrUtil.format("[{}] is not a Array!", array.getClass()));
|
||||
}
|
||||
|
||||
@ -1593,7 +1593,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
*/
|
||||
public static <T> boolean isAllEmpty(final T[] args) {
|
||||
for (final T obj : args) {
|
||||
if (! ObjUtil.isEmpty(obj)) {
|
||||
if (!ObjUtil.isEmpty(obj)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1609,7 +1609,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
* @since 4.5.18
|
||||
*/
|
||||
public static boolean isAllNotEmpty(final Object... args) {
|
||||
return ! hasEmpty(args);
|
||||
return !hasEmpty(args);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1623,7 +1623,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> boolean isAllNotNull(final T... array) {
|
||||
return ! hasNull(array);
|
||||
return !hasNull(array);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1829,7 +1829,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
}
|
||||
|
||||
for (int i = 0; i < subArray.length; i++) {
|
||||
if (! ObjUtil.equals(array[i + firstIndex], subArray[i])) {
|
||||
if (!ObjUtil.equals(array[i + firstIndex], subArray[i])) {
|
||||
return indexOfSub(array, firstIndex + 1, subArray);
|
||||
}
|
||||
}
|
||||
@ -1874,7 +1874,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
}
|
||||
|
||||
for (int i = 0; i < subArray.length; i++) {
|
||||
if (! ObjUtil.equals(array[i + firstIndex], subArray[i])) {
|
||||
if (!ObjUtil.equals(array[i + firstIndex], subArray[i])) {
|
||||
return lastIndexOfSub(array, firstIndex - 1, subArray);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
|
||||
*/
|
||||
public ArrayWrapper(final A array) {
|
||||
Assert.notNull(array, "Array must be not null!");
|
||||
if (! ArrayUtil.isArray(array)) {
|
||||
if (!ArrayUtil.isArray(array)) {
|
||||
throw new IllegalArgumentException("Object is not a array!");
|
||||
}
|
||||
this.componentType = array.getClass().getComponentType();
|
||||
@ -301,7 +301,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "SuspiciousSystemArraycopy"})
|
||||
public ArrayWrapper<A> insert(int index, Object arrayToAppend) {
|
||||
if (! ArrayUtil.isArray(arrayToAppend)) {
|
||||
if (!ArrayUtil.isArray(arrayToAppend)) {
|
||||
// 用户传入单个元素则创建单元素数组
|
||||
arrayToAppend = createSingleElementArray(arrayToAppend);
|
||||
}
|
||||
@ -355,7 +355,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "SuspiciousSystemArraycopy"})
|
||||
public ArrayWrapper<A> replace(final int index, Object values) {
|
||||
if (! ArrayUtil.isArray(values)) {
|
||||
if (!ArrayUtil.isArray(values)) {
|
||||
// 用户传入单个元素则创建单元素数组
|
||||
values = createSingleElementArray(values);
|
||||
}
|
||||
@ -537,7 +537,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
|
||||
for (int i = 0; i < this.length; i++) {
|
||||
compare = comparator.compare(get(i), get(i + 1));
|
||||
if ((isDESC && compare < 0) ||
|
||||
(! isDESC && compare > 0)) {
|
||||
(!isDESC && compare > 0)) {
|
||||
// 反序,前一个小于后一个则返回错
|
||||
// 正序,前一个大于后一个则返回错
|
||||
return false;
|
||||
|
@ -156,7 +156,7 @@ public class BeanDesc implements Serializable {
|
||||
PropDesc prop;
|
||||
for (final Field field : FieldUtil.getFields(this.beanClass)) {
|
||||
// 排除静态属性和对象子类
|
||||
if (! ModifierUtil.isStatic(field) && ! FieldUtil.isOuterClassField(field)) {
|
||||
if (!ModifierUtil.isStatic(field) && !FieldUtil.isOuterClassField(field)) {
|
||||
prop = createProp(field, gettersAndSetters);
|
||||
// 只有不存在时才放入,防止父类属性覆盖子类属性
|
||||
this.propMap.putIfAbsent(prop.getFieldName(), prop);
|
||||
@ -314,7 +314,7 @@ public class BeanDesc implements Serializable {
|
||||
}
|
||||
|
||||
// 非标准Setter方法跳过
|
||||
if (! methodName.startsWith("set")) {
|
||||
if (!methodName.startsWith("set")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class BeanPath implements Serializable {
|
||||
subBean = getFieldValue(subBean, patternPart);
|
||||
if (null == subBean) {
|
||||
// 支持表达式的第一个对象为Bean本身(若用户定义表达式$开头,则不做此操作)
|
||||
if (isFirst && ! this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
|
||||
if (isFirst && !this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
|
||||
subBean = bean;
|
||||
isFirst = false;
|
||||
} else {
|
||||
@ -186,7 +186,7 @@ public class BeanPath implements Serializable {
|
||||
subBean = getFieldValue(subBean, patternPart);
|
||||
if (null == subBean) {
|
||||
// 支持表达式的第一个对象为Bean本身(若用户定义表达式$开头,则不做此操作)
|
||||
if (isFirst && ! this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
|
||||
if (isFirst && !this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
|
||||
subBean = bean;
|
||||
isFirst = false;
|
||||
} else {
|
||||
@ -268,15 +268,15 @@ public class BeanPath implements Serializable {
|
||||
|
||||
if ('\'' == c) {
|
||||
// 结束
|
||||
isInWrap = (! isInWrap);
|
||||
isInWrap = (!isInWrap);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! isInWrap && ArrayUtil.contains(EXP_CHARS, c)) {
|
||||
if (!isInWrap && ArrayUtil.contains(EXP_CHARS, c)) {
|
||||
// 处理边界符号
|
||||
if (CharUtil.BRACKET_END == c) {
|
||||
// 中括号(数字下标)结束
|
||||
if (! isNumStart) {
|
||||
if (!isNumStart) {
|
||||
throw new IllegalArgumentException(StrUtil.format("Bad expression '{}':{}, we find ']' but no '[' !", expression, i));
|
||||
}
|
||||
isNumStart = false;
|
||||
|
@ -130,7 +130,7 @@ public class BeanUtil {
|
||||
if (method.getParameterCount() == 0) {
|
||||
final String name = method.getName();
|
||||
if (name.startsWith("get") || name.startsWith("is")) {
|
||||
if (! "getClass".equals(name)) {
|
||||
if (!"getClass".equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,7 @@ public class BeanUtil {
|
||||
public static boolean hasPublicField(final Class<?> clazz) {
|
||||
if (ClassUtil.isNormalClass(clazz)) {
|
||||
for (final Field field : clazz.getFields()) {
|
||||
if (ModifierUtil.isPublic(field) && ! ModifierUtil.isStatic(field)) {
|
||||
if (ModifierUtil.isPublic(field) && !ModifierUtil.isStatic(field)) {
|
||||
//非static的public字段
|
||||
return true;
|
||||
}
|
||||
@ -220,7 +220,7 @@ public class BeanUtil {
|
||||
}
|
||||
return ArrayUtil.filter(beanInfo.getPropertyDescriptors(), t -> {
|
||||
// 过滤掉getClass方法
|
||||
return ! "class".equals(t.getName());
|
||||
return !"class".equals(t.getName());
|
||||
});
|
||||
}
|
||||
|
||||
@ -821,7 +821,7 @@ public class BeanUtil {
|
||||
final String val = (String) FieldUtil.getFieldValue(bean, field);
|
||||
if (null != val) {
|
||||
final String trimVal = StrUtil.trim(val);
|
||||
if (! val.equals(trimVal)) {
|
||||
if (!val.equals(trimVal)) {
|
||||
// Field Value不为null,且首尾有空格才处理
|
||||
FieldUtil.setFieldValue(bean, field, trimVal);
|
||||
}
|
||||
@ -858,7 +858,7 @@ public class BeanUtil {
|
||||
if (ModifierUtil.isStatic(field)) {
|
||||
continue;
|
||||
}
|
||||
if ((! ArrayUtil.contains(ignoreFieldNames, field.getName()))
|
||||
if ((!ArrayUtil.contains(ignoreFieldNames, field.getName()))
|
||||
&& null != FieldUtil.getFieldValue(bean, field)) {
|
||||
return false;
|
||||
}
|
||||
@ -884,7 +884,7 @@ public class BeanUtil {
|
||||
if (ModifierUtil.isStatic(field)) {
|
||||
continue;
|
||||
}
|
||||
if ((! ArrayUtil.contains(ignoreFieldNames, field.getName()))
|
||||
if ((!ArrayUtil.contains(ignoreFieldNames, field.getName()))
|
||||
&& null == FieldUtil.getFieldValue(bean, field)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public class PropDesc {
|
||||
*/
|
||||
public boolean isReadable(final boolean checkTransient) {
|
||||
// 检查是否有getter方法或是否为public修饰
|
||||
if (null == this.getter && ! ModifierUtil.isPublic(this.field)) {
|
||||
if (null == this.getter && !ModifierUtil.isPublic(this.field)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ public class PropDesc {
|
||||
}
|
||||
|
||||
// 检查@PropIgnore注解
|
||||
return ! isIgnoreGet();
|
||||
return !isIgnoreGet();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,7 +189,7 @@ public class PropDesc {
|
||||
try {
|
||||
result = getValue(bean);
|
||||
} catch (final Exception e) {
|
||||
if (! ignoreError) {
|
||||
if (!ignoreError) {
|
||||
throw new BeanException(e, "Get value of [{}] error!", getFieldName());
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ public class PropDesc {
|
||||
*/
|
||||
public boolean isWritable(final boolean checkTransient) {
|
||||
// 检查是否有getter方法或是否为public修饰
|
||||
if (null == this.setter && ! ModifierUtil.isPublic(this.field)) {
|
||||
if (null == this.setter && !ModifierUtil.isPublic(this.field)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ public class PropDesc {
|
||||
}
|
||||
|
||||
// 检查@PropIgnore注解
|
||||
return ! isIgnoreSet();
|
||||
return !isIgnoreSet();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -277,24 +277,24 @@ public class PropDesc {
|
||||
|
||||
// issue#I4JQ1N@Gitee
|
||||
// 非覆盖模式下,如果目标值存在,则跳过
|
||||
if (! override && null != getValue(bean)) {
|
||||
if (!override && null != getValue(bean)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// 当类型不匹配的时候,执行默认转换
|
||||
if (null != value) {
|
||||
final Class<?> propClass = getFieldClass();
|
||||
if (! propClass.isInstance(value)) {
|
||||
if (!propClass.isInstance(value)) {
|
||||
value = Convert.convertWithCheck(propClass, value, null, ignoreError);
|
||||
}
|
||||
}
|
||||
|
||||
// 属性赋值
|
||||
if (null != value || ! ignoreNull) {
|
||||
if (null != value || !ignoreNull) {
|
||||
try {
|
||||
this.setValue(bean, value);
|
||||
} catch (final Exception e) {
|
||||
if (! ignoreError) {
|
||||
if (!ignoreError) {
|
||||
throw new BeanException(e, "Set value of [{}] error!", getFieldName());
|
||||
}
|
||||
// 忽略注入失败
|
||||
@ -382,11 +382,11 @@ public class PropDesc {
|
||||
boolean isTransient = ModifierUtil.hasModifier(this.field, ModifierUtil.ModifierType.TRANSIENT);
|
||||
|
||||
// 检查Getter方法
|
||||
if (! isTransient && null != this.getter) {
|
||||
if (!isTransient && null != this.getter) {
|
||||
isTransient = ModifierUtil.hasModifier(this.getter, ModifierUtil.ModifierType.TRANSIENT);
|
||||
|
||||
// 检查注解
|
||||
if (! isTransient) {
|
||||
if (!isTransient) {
|
||||
isTransient = AnnotationUtil.hasAnnotation(this.getter, Transient.class);
|
||||
}
|
||||
}
|
||||
@ -404,11 +404,11 @@ public class PropDesc {
|
||||
boolean isTransient = ModifierUtil.hasModifier(this.field, ModifierUtil.ModifierType.TRANSIENT);
|
||||
|
||||
// 检查Getter方法
|
||||
if (! isTransient && null != this.setter) {
|
||||
if (!isTransient && null != this.setter) {
|
||||
isTransient = ModifierUtil.hasModifier(this.setter, ModifierUtil.ModifierType.TRANSIENT);
|
||||
|
||||
// 检查注解
|
||||
if (! isTransient) {
|
||||
if (!isTransient) {
|
||||
isTransient = AnnotationUtil.hasAnnotation(this.setter, Transient.class);
|
||||
}
|
||||
}
|
||||
|
@ -61,14 +61,14 @@ public class BeanToBeanCopier<S, T> extends AbsCopier<S, T> {
|
||||
|
||||
final Map<String, PropDesc> sourcePropDescMap = BeanUtil.getBeanDesc(source.getClass()).getPropMap(copyOptions.ignoreCase);
|
||||
sourcePropDescMap.forEach((sFieldName, sDesc) -> {
|
||||
if (null == sFieldName || ! sDesc.isReadable(copyOptions.transientSupport)) {
|
||||
if (null == sFieldName || !sDesc.isReadable(copyOptions.transientSupport)) {
|
||||
// 字段空或不可读,跳过
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查源对象属性是否过滤属性
|
||||
Object sValue = sDesc.getValue(this.source);
|
||||
if (! copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
|
||||
if (!copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public class BeanToBeanCopier<S, T> extends AbsCopier<S, T> {
|
||||
// 检查目标字段可写性
|
||||
// 目标字段检查放在键值对编辑之后,因为键可能被编辑修改
|
||||
final PropDesc tDesc = targetPropDescMap.get(sFieldName);
|
||||
if (null == tDesc || ! tDesc.isWritable(this.copyOptions.transientSupport)) {
|
||||
if (null == tDesc || !tDesc.isWritable(this.copyOptions.transientSupport)) {
|
||||
// 字段不可写,跳过之
|
||||
return;
|
||||
}
|
||||
|
@ -60,14 +60,14 @@ public class BeanToMapCopier extends AbsCopier<Object, Map> {
|
||||
|
||||
final Map<String, PropDesc> sourcePropDescMap = BeanUtil.getBeanDesc(actualEditable).getPropMap(copyOptions.ignoreCase);
|
||||
sourcePropDescMap.forEach((sFieldName, sDesc) -> {
|
||||
if (null == sFieldName || ! sDesc.isReadable(copyOptions.transientSupport)) {
|
||||
if (null == sFieldName || !sDesc.isReadable(copyOptions.transientSupport)) {
|
||||
// 字段空或不可读,跳过
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查源对象属性是否过滤属性
|
||||
Object sValue = sDesc.getValue(this.source);
|
||||
if (! copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
|
||||
if (!copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public class BeanToMapCopier extends AbsCopier<Object, Map> {
|
||||
}
|
||||
|
||||
// 目标赋值
|
||||
if(null != sValue || ! copyOptions.ignoreNullValue){
|
||||
if(null != sValue || !copyOptions.ignoreNullValue){
|
||||
target.put(sFieldName, sValue);
|
||||
}
|
||||
});
|
||||
|
@ -177,7 +177,7 @@ public class CopyOptions implements Serializable {
|
||||
* @return CopyOptions
|
||||
*/
|
||||
public CopyOptions setIgnoreProperties(final String... ignoreProperties) {
|
||||
return setPropertiesFilter((field, o) -> ! ArrayUtil.contains(ignoreProperties, field.getName()));
|
||||
return setPropertiesFilter((field, o) -> !ArrayUtil.contains(ignoreProperties, field.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,7 +192,7 @@ public class CopyOptions implements Serializable {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <P, R> CopyOptions setIgnoreProperties(final SerFunction<P, R>... funcs) {
|
||||
final Set<String> ignoreProperties = ArrayUtil.mapToSet(funcs, LambdaUtil::getFieldName);
|
||||
return setPropertiesFilter((field, o) -> ! ignoreProperties.contains(field.getName()));
|
||||
return setPropertiesFilter((field, o) -> !ignoreProperties.contains(field.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,14 +89,14 @@ public class MapToBeanCopier<T> extends AbsCopier<Map<?, ?>, T> {
|
||||
// 检查目标字段可写性
|
||||
// 目标字段检查放在键值对编辑之后,因为键可能被编辑修改
|
||||
final PropDesc tDesc = findPropDesc(targetPropDescMap, sFieldName);
|
||||
if (null == tDesc || ! tDesc.isWritable(this.copyOptions.transientSupport)) {
|
||||
if (null == tDesc || !tDesc.isWritable(this.copyOptions.transientSupport)) {
|
||||
// 字段不可写,跳过之
|
||||
return;
|
||||
}
|
||||
|
||||
Object newValue = entry.getValue();
|
||||
// 检查目标是否过滤属性
|
||||
if (! copyOptions.testPropertyFilter(tDesc.getField(), newValue)) {
|
||||
if (!copyOptions.testPropertyFilter(tDesc.getField(), newValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class MapToMapCopier extends AbsCopier<Map, Map> {
|
||||
|
||||
final Object targetValue = target.get(sKey);
|
||||
// 非覆盖模式下,如果目标值存在,则跳过
|
||||
if (! copyOptions.override && null != targetValue) {
|
||||
if (!copyOptions.override && null != targetValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class ValueProviderToBeanCopier<T> extends AbsCopier<ValueProvider<String
|
||||
}
|
||||
|
||||
// 检查目标字段可写性
|
||||
if (null == tDesc || ! tDesc.isWritable(this.copyOptions.transientSupport)) {
|
||||
if (null == tDesc || !tDesc.isWritable(this.copyOptions.transientSupport)) {
|
||||
// 字段不可写,跳过之
|
||||
return;
|
||||
}
|
||||
@ -82,13 +82,13 @@ public class ValueProviderToBeanCopier<T> extends AbsCopier<ValueProvider<String
|
||||
return;
|
||||
}
|
||||
// 无字段内容跳过
|
||||
if(! source.containsKey(tFieldName)){
|
||||
if(!source.containsKey(tFieldName)){
|
||||
return;
|
||||
}
|
||||
final Object sValue = source.value(tFieldName, fieldType);
|
||||
|
||||
// 检查目标对象属性是否过滤属性
|
||||
if (! copyOptions.testPropertyFilter(tDesc.getField(), sValue)) {
|
||||
if (!copyOptions.testPropertyFilter(tDesc.getField(), sValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class SimpleCache<K, V> implements Iterable<Map.Entry<K, V>>, Serializabl
|
||||
*/
|
||||
public V get(final K key, final Predicate<V> validPredicate, final SerSupplier<V> supplier) {
|
||||
V v = get(key);
|
||||
if ((null != validPredicate && null != v && ! validPredicate.test(v))) {
|
||||
if ((null != validPredicate && null != v && !validPredicate.test(v))) {
|
||||
v = null;
|
||||
}
|
||||
if (null == v && null != supplier) {
|
||||
@ -118,7 +118,7 @@ public class SimpleCache<K, V> implements Iterable<Map.Entry<K, V>>, Serializabl
|
||||
try {
|
||||
// 双重检查,防止在竞争锁的过程中已经有其它线程写入
|
||||
v = get(key);
|
||||
if (null == v || (null != validPredicate && ! validPredicate.test(v))) {
|
||||
if (null == v || (null != validPredicate && !validPredicate.test(v))) {
|
||||
v = supplier.get();
|
||||
put(key, v);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class CacheObjIterator<K, V> implements Iterator<CacheObj<K, V>>, Seriali
|
||||
*/
|
||||
@Override
|
||||
public CacheObj<K, V> next() {
|
||||
if (! hasNext()) {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
final CacheObj<K, V> cachedObject = nextValue;
|
||||
|
@ -53,7 +53,7 @@ public abstract class ReentrantCache<K, V> extends AbstractCache<K, V> {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! co.isExpired()) {
|
||||
if (!co.isExpired()) {
|
||||
// 命中
|
||||
return true;
|
||||
}
|
||||
@ -80,7 +80,7 @@ public abstract class ReentrantCache<K, V> extends AbstractCache<K, V> {
|
||||
if (null == co) {
|
||||
missCount.increment();
|
||||
return null;
|
||||
} else if (! co.isExpired()) {
|
||||
} else if (!co.isExpired()) {
|
||||
hitCount.increment();
|
||||
return co.get(isUpdateLastAccess);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public abstract class StampedCache<K, V> extends AbstractCache<K, V>{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! co.isExpired()) {
|
||||
if (!co.isExpired()) {
|
||||
// 命中
|
||||
return true;
|
||||
}
|
||||
@ -71,7 +71,7 @@ public abstract class StampedCache<K, V> extends AbstractCache<K, V>{
|
||||
// 尝试读取缓存,使用乐观读锁
|
||||
long stamp = lock.tryOptimisticRead();
|
||||
CacheObj<K, V> co = getWithoutLock(key);
|
||||
if(! lock.validate(stamp)){
|
||||
if(!lock.validate(stamp)){
|
||||
// 有写线程修改了此对象,悲观读
|
||||
stamp = lock.readLock();
|
||||
try {
|
||||
@ -85,7 +85,7 @@ public abstract class StampedCache<K, V> extends AbstractCache<K, V>{
|
||||
if (null == co) {
|
||||
missCount.increment();
|
||||
return null;
|
||||
} else if (! co.isExpired()) {
|
||||
} else if (!co.isExpired()) {
|
||||
hitCount.increment();
|
||||
return co.get(isUpdateLastAccess);
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ public class ClassLoaderUtil {
|
||||
int lastDotIndex = name.lastIndexOf(PACKAGE_SEPARATOR);
|
||||
Class<?> clazz = null;
|
||||
while (lastDotIndex > 0) {// 类与内部类的分隔符不能在第一位,因此>0
|
||||
if (! Character.isUpperCase(name.charAt(lastDotIndex + 1))) {
|
||||
if (!Character.isUpperCase(name.charAt(lastDotIndex + 1))) {
|
||||
// 类名必须大写,非大写的类名跳过
|
||||
break;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class JarClassLoader extends URLClassLoader {
|
||||
* @since 4.4.2
|
||||
*/
|
||||
private static boolean isJarFile(final File file) {
|
||||
if (! FileUtil.isFile(file)) {
|
||||
if (!FileUtil.isFile(file)) {
|
||||
return false;
|
||||
}
|
||||
return file.getPath().toLowerCase().endsWith(".jar");
|
||||
|
@ -39,7 +39,7 @@ public class Caesar {
|
||||
char c;
|
||||
for (int i = 0; i < len; i++) {
|
||||
c = message.charAt(i);
|
||||
if (! Character.isLetter(c)) {
|
||||
if (!Character.isLetter(c)) {
|
||||
continue;
|
||||
}
|
||||
plain[i] = encodeChar(c, offset);
|
||||
@ -61,7 +61,7 @@ public class Caesar {
|
||||
char c;
|
||||
for (int i = 0; i < len; i++) {
|
||||
c = cipherText.charAt(i);
|
||||
if (! Character.isLetter(c)) {
|
||||
if (!Character.isLetter(c)) {
|
||||
continue;
|
||||
}
|
||||
plain[i] = decodeChar(c, offset);
|
||||
|
@ -362,7 +362,7 @@ public class Hashids implements Encoder<long[], String>, Decoder<String, long[]>
|
||||
final char[] currentAlphabet = Arrays.copyOf(alphabet, alphabet.length);
|
||||
|
||||
for (int i = startIdx + 1; i < endIdx; i++) {
|
||||
if (! separatorsSet.contains(hash.charAt(i))) {
|
||||
if (!separatorsSet.contains(hash.charAt(i))) {
|
||||
block.append(hash.charAt(i));
|
||||
// continue if we have not reached the end, yet
|
||||
if (i < endIdx - 1) {
|
||||
|
@ -163,7 +163,7 @@ public class Morse {
|
||||
final char dit = this.dit;
|
||||
final char dah = this.dah;
|
||||
final char split = this.split;
|
||||
if (! StrUtil.containsOnly(morse, dit, dah, split)) {
|
||||
if (!StrUtil.containsOnly(morse, dit, dah, split)) {
|
||||
throw new IllegalArgumentException("Incorrect morse.");
|
||||
}
|
||||
final List<String> words = SplitUtil.split(morse, String.valueOf(split));
|
||||
|
@ -108,7 +108,7 @@ public class Base58 {
|
||||
final byte[] payload = Arrays.copyOfRange(data, withVersion ? 1 : 0, data.length - CHECKSUM_SIZE);
|
||||
final byte[] checksum = Arrays.copyOfRange(data, data.length - CHECKSUM_SIZE, data.length);
|
||||
final byte[] expectedChecksum = checksum(payload);
|
||||
if (! Arrays.equals(checksum, expectedChecksum)) {
|
||||
if (!Arrays.equals(checksum, expectedChecksum)) {
|
||||
throw new ValidateException("Base58 checksum is invalid");
|
||||
}
|
||||
return payload;
|
||||
|
@ -290,7 +290,7 @@ public class Base64 {
|
||||
} else if ('=' == base64Byte) {
|
||||
// 发现'=' 标记之
|
||||
hasPadding = true;
|
||||
} else if (! (Base64Decoder.INSTANCE.isBase64Code(base64Byte) || isWhiteSpace(base64Byte))) {
|
||||
} else if (!(Base64Decoder.INSTANCE.isBase64Code(base64Byte) || isWhiteSpace(base64Byte))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class ConsistentHash<T> implements Serializable {
|
||||
return null;
|
||||
}
|
||||
int hash = hashFunc.hash32(key);
|
||||
if (! circle.containsKey(hash)) {
|
||||
if (!circle.containsKey(hash)) {
|
||||
final SortedMap<Integer, T> tailMap = circle.tailMap(hash); //返回此映射的部分视图,其键大于等于 hash
|
||||
hash = tailMap.isEmpty() ? circle.firstKey() : tailMap.firstKey();
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class CollUtil {
|
||||
* @return 是否为空
|
||||
*/
|
||||
public static boolean isEmpty(final Enumeration<?> enumeration) {
|
||||
return null == enumeration || ! enumeration.hasMoreElements();
|
||||
return null == enumeration || !enumeration.hasMoreElements();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2033,7 +2033,7 @@ public class CollUtil {
|
||||
|
||||
@Override
|
||||
public int hash32(final T t) {
|
||||
if (null == t || ! BeanUtil.isBean(t.getClass())) {
|
||||
if (null == t || !BeanUtil.isBean(t.getClass())) {
|
||||
// 非Bean放在同一子分组中
|
||||
return 0;
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ public class ListUtil {
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public static <T> List<T> addAllIfNotContains(final List<T> list, final List<T> otherList) {
|
||||
for (final T t : otherList) {
|
||||
if (! list.contains(t)) {
|
||||
if (!list.contains(t)) {
|
||||
list.add(t);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public abstract class ComputeIter<T> implements Iterator<T> {
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
if (! hasNext()) {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException("No more lines");
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class FilterIter<E> implements Iterator<E> {
|
||||
|
||||
@Override
|
||||
public E next() {
|
||||
if (! nextObjectSet && ! setNextObject()) {
|
||||
if (!nextObjectSet && !setNextObject()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
nextObjectSet = false;
|
||||
|
@ -89,7 +89,7 @@ public class IterChain<T> implements Iterator<T>, Chain<Iterator<T>, IterChain<T
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
if (! hasNext()) {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class IterUtil {
|
||||
* @return 是否为空
|
||||
*/
|
||||
public static boolean isEmpty(final Iterator<?> iterator) {
|
||||
return null == iterator || ! iterator.hasNext();
|
||||
return null == iterator || !iterator.hasNext();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -737,12 +737,12 @@ public class IterUtil {
|
||||
while (iter1.hasNext() && iter2.hasNext()) {
|
||||
obj1 = iter1.next();
|
||||
obj2 = iter2.next();
|
||||
if (! Objects.equals(obj1, obj2)) {
|
||||
if (!Objects.equals(obj1, obj2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 当两个Iterable长度不一致时返回false
|
||||
return ! (iter1.hasNext() || iter2.hasNext());
|
||||
return !(iter1.hasNext() || iter2.hasNext());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ public class PartitionIter<T> implements IterableIter<List<T>>, Serializable {
|
||||
public List<T> next() {
|
||||
final List<T> list = new ArrayList<>(this.partitionSize);
|
||||
for (int i = 0; i < this.partitionSize; i++) {
|
||||
if (! iterator.hasNext()) {
|
||||
if (!iterator.hasNext()) {
|
||||
break;
|
||||
}
|
||||
list.add(iterator.next());
|
||||
|
@ -64,7 +64,7 @@ public class ZipCopyVisitor extends SimpleFileVisitor<Path> {
|
||||
} catch (final DirectoryNotEmptyException ignore) {
|
||||
// 目录已经存在,则跳过
|
||||
} catch (final FileAlreadyExistsException e) {
|
||||
if (! Files.isDirectory(targetDir)) {
|
||||
if (!Files.isDirectory(targetDir)) {
|
||||
throw e;
|
||||
}
|
||||
// 目录非空情况下,跳过创建目录
|
||||
|
@ -976,7 +976,7 @@ public class ZipUtil {
|
||||
name = entry.getName();
|
||||
if (StrUtil.isEmpty(dir) || name.startsWith(dir)) {
|
||||
final String nameSuffix = StrUtil.removePrefix(name, dir);
|
||||
if (StrUtil.isNotEmpty(nameSuffix) && ! StrUtil.contains(nameSuffix, CharUtil.SLASH)) {
|
||||
if (StrUtil.isNotEmpty(nameSuffix) && !StrUtil.contains(nameSuffix, CharUtil.SLASH)) {
|
||||
fileNames.add(nameSuffix);
|
||||
}
|
||||
}
|
||||
@ -1002,7 +1002,7 @@ public class ZipUtil {
|
||||
if (null == srcFile) {
|
||||
continue;
|
||||
}
|
||||
if (! srcFile.exists()) {
|
||||
if (!srcFile.exists()) {
|
||||
throw new UtilException(StrUtil.format("File [{}] not exist!", srcFile.getAbsolutePath()));
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class ZipWriter implements Closeable {
|
||||
String srcRootDir;
|
||||
try {
|
||||
srcRootDir = file.getCanonicalPath();
|
||||
if ((! file.isDirectory()) || withSrcDir) {
|
||||
if ((!file.isDirectory()) || withSrcDir) {
|
||||
// 若是文件,则将父目录完整路径都截取掉;若设置包含目录,则将上级目录全部截取掉,保留本目录名
|
||||
srcRootDir = file.getCanonicalFile().getParentFile().getCanonicalPath();
|
||||
}
|
||||
@ -259,7 +259,7 @@ public class ZipWriter implements Closeable {
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
private void _add(final File file, final String srcRootDir, final FileFilter filter) throws IORuntimeException {
|
||||
if (null == file || (null != filter && ! filter.accept(file))) {
|
||||
if (null == file || (null != filter && !filter.accept(file))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public enum BasicType {
|
||||
* @return 包装类
|
||||
*/
|
||||
public static Class<?> wrap(final Class<?> clazz, boolean errorReturnNull) {
|
||||
if (null == clazz || ! clazz.isPrimitive()) {
|
||||
if (null == clazz || !clazz.isPrimitive()) {
|
||||
return clazz;
|
||||
}
|
||||
final Class<?> result = WRAPPER_PRIMITIVE_MAP.getInverse().get(clazz);
|
||||
|
@ -107,7 +107,7 @@ public class NumberChineseFormatter {
|
||||
yuan = yuan / 10;
|
||||
|
||||
// 元
|
||||
if (! isMoneyMode || 0 != yuan) {
|
||||
if (!isMoneyMode || 0 != yuan) {
|
||||
// 金额模式下,无需“零元”
|
||||
chineseStr.append(longToChinese(yuan, isUseTraditional));
|
||||
if (isMoneyMode) {
|
||||
@ -124,14 +124,14 @@ public class NumberChineseFormatter {
|
||||
}
|
||||
|
||||
// 小数部分
|
||||
if (! isMoneyMode) {
|
||||
if (!isMoneyMode) {
|
||||
chineseStr.append("点");
|
||||
}
|
||||
|
||||
// 角
|
||||
if (0 == yuan && 0 == jiao) {
|
||||
// 元和角都为0时,只有非金额模式下补“零”
|
||||
if (! isMoneyMode) {
|
||||
if (!isMoneyMode) {
|
||||
chineseStr.append("零");
|
||||
}
|
||||
} else {
|
||||
@ -356,7 +356,7 @@ public class NumberChineseFormatter {
|
||||
for (int i = 0; temp > 0; i++) {
|
||||
final int digit = temp % 10;
|
||||
if (digit == 0) { // 取到的数字为 0
|
||||
if (! lastIsZero) {
|
||||
if (!lastIsZero) {
|
||||
// 前一个数字不是 0,则在当前汉字串前加“零”字;
|
||||
chineseStr.insert(0, "零");
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class NumberWordFormatter {
|
||||
}
|
||||
int index = -1;
|
||||
double res = value;
|
||||
while (res > 10 && (! isTwo || index < 1)) {
|
||||
while (res > 10 && (!isTwo || index < 1)) {
|
||||
if (res >= 1000) {
|
||||
res = res / 1000;
|
||||
index++;
|
||||
@ -119,7 +119,7 @@ public class NumberWordFormatter {
|
||||
StringBuilder lm = new StringBuilder(); // 用来存放转换后的整数部分
|
||||
for (int i = 0; i < lstrrev.length() / 3; i++) {
|
||||
a[i] = StrUtil.reverse(lstrrev.substring(3 * i, 3 * i + 3)); // 截取第一个三位
|
||||
if (! "000".equals(a[i])) { // 用来避免这种情况:1000000 = one million
|
||||
if (!"000".equals(a[i])) { // 用来避免这种情况:1000000 = one million
|
||||
// thousand only
|
||||
if (i != 0) {
|
||||
lm.insert(0, transThree(a[i]) + " " + parseMore(i) + " "); // 加:
|
||||
|
@ -34,7 +34,7 @@ public class AtomicReferenceConverter extends AbstractConverter {
|
||||
//尝试将值转换为Reference泛型的类型
|
||||
Object targetValue = null;
|
||||
final Type paramType = TypeUtil.getTypeArgument(AtomicReference.class);
|
||||
if(! TypeUtil.isUnknown(paramType)){
|
||||
if(!TypeUtil.isUnknown(paramType)){
|
||||
targetValue = CompositeConverter.getInstance().convert(paramType, value);
|
||||
}
|
||||
if(null == targetValue){
|
||||
|
@ -44,7 +44,7 @@ public class EnumConverter extends AbstractConverter {
|
||||
@Override
|
||||
protected Object convertInternal(final Class<?> targetClass, final Object value) {
|
||||
Enum enumValue = tryConvertEnum(value, targetClass);
|
||||
if (null == enumValue && ! value instanceof String) {
|
||||
if (null == enumValue && !(value instanceof String)) {
|
||||
// 最后尝试先将value转String,再valueOf转换
|
||||
enumValue = Enum.valueOf((Class) targetClass, convertToStr(value));
|
||||
}
|
||||
@ -134,7 +134,7 @@ public class EnumConverter extends AbstractConverter {
|
||||
.filter(ModifierUtil::isStatic)
|
||||
.filter(m -> m.getReturnType() == enumClass)
|
||||
.filter(m -> m.getParameterCount() == 1)
|
||||
.filter(m -> ! "valueOf".equals(m.getName()))
|
||||
.filter(m -> !"valueOf".equals(m.getName()))
|
||||
.collect(Collectors.toMap(m -> m.getParameterTypes()[0], m -> m, (k1, k2) -> k1)));
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class ReferenceConverter extends AbstractConverter {
|
||||
//尝试将值转换为Reference泛型的类型
|
||||
Object targetValue = null;
|
||||
final Type paramType = TypeUtil.getTypeArgument(targetClass);
|
||||
if(! TypeUtil.isUnknown(paramType)){
|
||||
if(!TypeUtil.isUnknown(paramType)){
|
||||
targetValue = CompositeConverter.getInstance().convert(paramType, value);
|
||||
}
|
||||
if(null == targetValue){
|
||||
|
@ -777,7 +777,7 @@ public class CalendarUtil {
|
||||
final int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
|
||||
final boolean isLastDayOfMonthBirth = dayOfMonthBirth == cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
// issue#I6E6ZG,法定生日当天不算年龄,从第二天开始计算
|
||||
if ((! isLastDayOfMonth || ! isLastDayOfMonthBirth) && dayOfMonth <= dayOfMonthBirth) {
|
||||
if ((!isLastDayOfMonth || !isLastDayOfMonthBirth) && dayOfMonth <= dayOfMonthBirth) {
|
||||
// 如果生日在当月,但是未达到生日当天的日期,年龄减一
|
||||
age--;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class DateBetween implements Serializable {
|
||||
final int betweenMonthOfYear = endCal.get(Calendar.MONTH) - beginCal.get(Calendar.MONTH);
|
||||
|
||||
final int result = betweenYear * 12 + betweenMonthOfYear;
|
||||
if (! isReset) {
|
||||
if (!isReset) {
|
||||
endCal.set(Calendar.YEAR, beginCal.get(Calendar.YEAR));
|
||||
endCal.set(Calendar.MONTH, beginCal.get(Calendar.MONTH));
|
||||
final long between = endCal.getTimeInMillis() - beginCal.getTimeInMillis();
|
||||
@ -148,7 +148,7 @@ public class DateBetween implements Serializable {
|
||||
final Calendar endCal = DateUtil.calendar(end);
|
||||
|
||||
final int result = endCal.get(Calendar.YEAR) - beginCal.get(Calendar.YEAR);
|
||||
if (! isReset) {
|
||||
if (!isReset) {
|
||||
// 考虑闰年的2月情况
|
||||
if (Calendar.FEBRUARY == beginCal.get(Calendar.MONTH) && Calendar.FEBRUARY == endCal.get(Calendar.MONTH)) {
|
||||
if (beginCal.get(Calendar.DAY_OF_MONTH) == beginCal.getActualMaximum(Calendar.DAY_OF_MONTH)
|
||||
|
@ -431,7 +431,7 @@ public class DateTime extends Date {
|
||||
calendar.set(field, value);
|
||||
|
||||
DateTime dt = this;
|
||||
if (! mutable) {
|
||||
if (!mutable) {
|
||||
dt = ObjUtil.clone(this);
|
||||
}
|
||||
return dt.setTimeInternal(calendar.getTimeInMillis());
|
||||
|
@ -677,7 +677,7 @@ public class DateUtil extends CalendarUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! isUppercase) {
|
||||
if (!isUppercase) {
|
||||
return (withTime ? DatePattern.CHINESE_DATE_TIME_FORMAT : DatePattern.CHINESE_DATE_FORMAT).format(date);
|
||||
}
|
||||
|
||||
@ -1434,11 +1434,11 @@ public class DateUtil extends CalendarUtil {
|
||||
boolean isIn = rangeMin < thisMills && thisMills < rangeMax;
|
||||
|
||||
// 若不满足,则再判断是否在时间范围的边界上
|
||||
if (! isIn && includeBegin) {
|
||||
if (!isIn && includeBegin) {
|
||||
isIn = thisMills == rangeMin;
|
||||
}
|
||||
|
||||
if (! isIn && includeEnd) {
|
||||
if (!isIn && includeEnd) {
|
||||
isIn = thisMills == rangeMax;
|
||||
}
|
||||
|
||||
|
@ -226,11 +226,11 @@ public class TemporalAccessorUtil extends TemporalUtil{
|
||||
boolean isIn = rangeMin < thisMills && thisMills < rangeMax;
|
||||
|
||||
// 若不满足,则再判断是否在时间范围的边界上
|
||||
if (! isIn && includeBegin) {
|
||||
if (!isIn && includeBegin) {
|
||||
isIn = thisMills == rangeMin;
|
||||
}
|
||||
|
||||
if (! isIn && includeEnd) {
|
||||
if (!isIn && includeEnd) {
|
||||
isIn = thisMills == rangeMax;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class ChineseDate {
|
||||
}
|
||||
|
||||
this.isLeapMonth = leapMonth > 0 && (month == (leapMonth + 1));
|
||||
if (hasLeapMonth && ! this.isLeapMonth) {
|
||||
if (hasLeapMonth && !this.isLeapMonth) {
|
||||
// 当前月份前有闰月,则月份显示要-1,除非当前月份就是润月
|
||||
month--;
|
||||
}
|
||||
@ -453,7 +453,7 @@ public class ChineseDate {
|
||||
boolean isAdd = false;
|
||||
for (int i = 1; i < chineseMonth; i++) {
|
||||
leap = LunarInfo.leapMonth(chineseYear);
|
||||
if (! isAdd) {//处理闰月
|
||||
if (!isAdd) {//处理闰月
|
||||
if (leap <= i && leap > 0) {
|
||||
offset += LunarInfo.leapDays(chineseYear);
|
||||
isAdd = true;
|
||||
|
@ -265,7 +265,7 @@ public class FastDateParser extends SimpleDateBasic implements PositionDateParse
|
||||
while (lt.hasNext()) {
|
||||
final StrategyAndWidth strategyAndWidth = lt.next();
|
||||
final int maxWidth = strategyAndWidth.getMaxWidth(lt);
|
||||
if (! strategyAndWidth.strategy.parse(this, calendar, source, pos, maxWidth)) {
|
||||
if (!strategyAndWidth.strategy.parse(this, calendar, source, pos, maxWidth)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class ISO8601DateParser extends DefaultDateBasic implements DateParser {
|
||||
if (StrUtil.isBlank(zoneOffset)) {
|
||||
throw new DateException("Invalid format: [{}]", source);
|
||||
}
|
||||
if (! StrUtil.contains(zoneOffset, ':')) {
|
||||
if (!StrUtil.contains(zoneOffset, ':')) {
|
||||
// +0800转换为+08:00
|
||||
final String pre = StrUtil.subBefore(source, '+', true);
|
||||
source = pre + "+" + zoneOffset.substring(0, 2) + ":" + "00";
|
||||
|
@ -404,7 +404,7 @@ public class ExceptionUtil {
|
||||
*/
|
||||
public static List<Throwable> getThrowableList(Throwable throwable) {
|
||||
final List<Throwable> list = new ArrayList<>();
|
||||
while (throwable != null && ! list.contains(throwable)) {
|
||||
while (throwable != null && !list.contains(throwable)) {
|
||||
list.add(throwable);
|
||||
throwable = throwable.getCause();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class AppendableWriter extends Writer implements Appendable {
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if (! closed) {
|
||||
if (!closed) {
|
||||
flush();
|
||||
if (appendable instanceof Closeable) {
|
||||
((Closeable) appendable).close();
|
||||
|
@ -717,7 +717,7 @@ public class IoUtil extends NioUtil {
|
||||
if (null == in) {
|
||||
return null;
|
||||
}
|
||||
if (! in.markSupported()) {
|
||||
if (!in.markSupported()) {
|
||||
return new BufferedInputStream(in);
|
||||
}
|
||||
return in;
|
||||
@ -734,7 +734,7 @@ public class IoUtil extends NioUtil {
|
||||
if (null == reader) {
|
||||
return null;
|
||||
}
|
||||
if (! reader.markSupported()) {
|
||||
if (!reader.markSupported()) {
|
||||
return new BufferedReader(reader);
|
||||
}
|
||||
return reader;
|
||||
@ -951,10 +951,10 @@ public class IoUtil extends NioUtil {
|
||||
* @since 4.0.6
|
||||
*/
|
||||
public static boolean contentEquals(InputStream input1, InputStream input2) throws IORuntimeException {
|
||||
if (! (input1 instanceof BufferedInputStream)) {
|
||||
if (!(input1 instanceof BufferedInputStream)) {
|
||||
input1 = new BufferedInputStream(input1);
|
||||
}
|
||||
if (! (input2 instanceof BufferedInputStream)) {
|
||||
if (!(input2 instanceof BufferedInputStream)) {
|
||||
input2 = new BufferedInputStream(input2);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class LineReader extends ReaderWrapper implements Iterable<String> {
|
||||
}
|
||||
if (CharUtil.BACKSLASH == c) {
|
||||
// 转义符转义,行尾需要使用'\'时,使用转义符转义,即`\\`
|
||||
if (! precedingBackslash) {
|
||||
if (!precedingBackslash) {
|
||||
// 转义符,添加标识,但是不加入字符
|
||||
precedingBackslash = true;
|
||||
continue;
|
||||
|
@ -37,7 +37,7 @@ public class SerializeUtil {
|
||||
* @throws UtilException IO异常和ClassNotFoundException封装
|
||||
*/
|
||||
public static <T> T clone(final T obj) {
|
||||
if (! (obj instanceof Serializable)) {
|
||||
if (!(obj instanceof Serializable)) {
|
||||
return null;
|
||||
}
|
||||
return deserialize(serialize(obj));
|
||||
@ -52,7 +52,7 @@ public class SerializeUtil {
|
||||
* @return 序列化后的字节码
|
||||
*/
|
||||
public static <T> byte[] serialize(final T obj) {
|
||||
if (! (obj instanceof Serializable)) {
|
||||
if (!(obj instanceof Serializable)) {
|
||||
return null;
|
||||
}
|
||||
final FastByteArrayOutputStream byteOut = new FastByteArrayOutputStream();
|
||||
|
@ -1507,7 +1507,7 @@ public enum FileMagicNumber {
|
||||
*/
|
||||
private static FileMagicNumber matchDocument(final byte[] bytes) {
|
||||
final FileMagicNumber fileMagicNumber = FileMagicNumber.matchOpenXmlMime(bytes, (byte) 0x1e);
|
||||
if (! fileMagicNumber.equals(UNKNOWN)) {
|
||||
if (!fileMagicNumber.equals(UNKNOWN)) {
|
||||
return fileMagicNumber;
|
||||
}
|
||||
final byte[] bytes1 = new byte[]{0x5B, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x5F, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5D, 0x2E, 0x78, 0x6D, 0x6C};
|
||||
@ -1516,7 +1516,7 @@ public enum FileMagicNumber {
|
||||
final boolean flag1 = FileMagicNumber.compareBytes(bytes, bytes1, (byte) 0x1e);
|
||||
final boolean flag2 = FileMagicNumber.compareBytes(bytes, bytes2, (byte) 0x1e);
|
||||
final boolean flag3 = FileMagicNumber.compareBytes(bytes, bytes3, (byte) 0x1e);
|
||||
if (! (flag1 || flag2 || flag3)) {
|
||||
if (!(flag1 || flag2 || flag3)) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
int index = 0;
|
||||
@ -1526,7 +1526,7 @@ public enum FileMagicNumber {
|
||||
continue;
|
||||
}
|
||||
final FileMagicNumber fn = FileMagicNumber.matchOpenXmlMime(bytes, index + 30);
|
||||
if (! fn.equals(UNKNOWN)) {
|
||||
if (!fn.equals(UNKNOWN)) {
|
||||
return fn;
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public class FileNameUtil {
|
||||
* @since 3.3.1
|
||||
*/
|
||||
public static boolean containsInvalid(final String fileName) {
|
||||
return (! StrUtil.isBlank(fileName)) && ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
|
||||
return (!StrUtil.isBlank(fileName)) && ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -388,7 +388,7 @@ public class FileNameUtil {
|
||||
// 去除类似于/C:这类路径开头的斜杠
|
||||
prefix = prefix.substring(1);
|
||||
}
|
||||
if (! prefix.contains(StrUtil.SLASH)) {
|
||||
if (!prefix.contains(StrUtil.SLASH)) {
|
||||
pathToUse = pathToUse.substring(prefixIndex + 1);
|
||||
} else {
|
||||
// 如果前缀中包含/,说明非Windows风格path
|
||||
@ -408,7 +408,7 @@ public class FileNameUtil {
|
||||
for (int i = pathList.size() - 1; i >= 0; i--) {
|
||||
element = pathList.get(i);
|
||||
// 只处理非.的目录,即只处理非当前目录
|
||||
if (! StrUtil.DOT.equals(element)) {
|
||||
if (!StrUtil.DOT.equals(element)) {
|
||||
if (StrUtil.DOUBLE_DOT.equals(element)) {
|
||||
tops++;
|
||||
} else {
|
||||
|
@ -256,10 +256,10 @@ public class FileReader extends FileWrapper {
|
||||
* @throws IORuntimeException IO异常
|
||||
*/
|
||||
private void checkFile() throws IORuntimeException {
|
||||
if (! file.exists()) {
|
||||
if (!file.exists()) {
|
||||
throw new IORuntimeException("File not exist: " + file);
|
||||
}
|
||||
if (! file.isFile()) {
|
||||
if (!file.isFile()) {
|
||||
throw new IORuntimeException("Not a file:" + file);
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class FileUtil extends PathUtil {
|
||||
* @return 是否为空,当提供非目录时,返回false
|
||||
*/
|
||||
public static boolean isEmpty(final File file) {
|
||||
if (null == file || ! file.exists()) {
|
||||
if (null == file || !file.exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -448,7 +448,7 @@ public class FileUtil extends PathUtil {
|
||||
*/
|
||||
public static boolean exists(final String directory, final String regexp) {
|
||||
final File file = new File(directory);
|
||||
if (! file.exists()) {
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ public class FileUtil extends PathUtil {
|
||||
* @return 最后修改时间
|
||||
*/
|
||||
public static Date lastModifiedTime(final File file) {
|
||||
if (! exists(file)) {
|
||||
if (!exists(file)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ public class FileUtil extends PathUtil {
|
||||
* @since 5.7.21
|
||||
*/
|
||||
public static long size(final File file, final boolean includeDirSize) {
|
||||
if (null == file || ! file.exists() || isSymlink(file)) {
|
||||
if (null == file || !file.exists() || isSymlink(file)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ public class FileUtil extends PathUtil {
|
||||
* @since 5.7.22
|
||||
*/
|
||||
public static int getTotalLines(final File file) {
|
||||
if (! isFile(file)) {
|
||||
if (!isFile(file)) {
|
||||
throw new IORuntimeException("Input must be a File");
|
||||
}
|
||||
try (final LineNumberReader lineNumberReader = new LineNumberReader(new java.io.FileReader(file))) {
|
||||
@ -569,7 +569,7 @@ public class FileUtil extends PathUtil {
|
||||
* @return 是否晚于给定时间
|
||||
*/
|
||||
public static boolean newerThan(final File file, final File reference) {
|
||||
if (null == reference || ! reference.exists()) {
|
||||
if (null == reference || !reference.exists()) {
|
||||
return true;// 文件一定比一个不存在的文件新
|
||||
}
|
||||
return newerThan(file, reference.lastModified());
|
||||
@ -583,7 +583,7 @@ public class FileUtil extends PathUtil {
|
||||
* @return 是否晚于给定时间
|
||||
*/
|
||||
public static boolean newerThan(final File file, final long timeMillis) {
|
||||
if (null == file || ! file.exists()) {
|
||||
if (null == file || !file.exists()) {
|
||||
return false;// 不存在的文件一定比任何时间旧
|
||||
}
|
||||
return file.lastModified() > timeMillis;
|
||||
@ -617,7 +617,7 @@ public class FileUtil extends PathUtil {
|
||||
if (null == file) {
|
||||
return null;
|
||||
}
|
||||
if (! file.exists()) {
|
||||
if (!file.exists()) {
|
||||
mkParentDirs(file);
|
||||
try {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
@ -759,7 +759,7 @@ public class FileUtil extends PathUtil {
|
||||
if (dir == null) {
|
||||
return null;
|
||||
}
|
||||
if (! dir.exists()) {
|
||||
if (!dir.exists()) {
|
||||
mkdirsSafely(dir, 5, 1);
|
||||
}
|
||||
return dir;
|
||||
@ -1212,10 +1212,10 @@ public class FileUtil extends PathUtil {
|
||||
public static boolean equals(final File file1, final File file2) throws IORuntimeException {
|
||||
Assert.notNull(file1);
|
||||
Assert.notNull(file2);
|
||||
if (! file1.exists() || ! file2.exists()) {
|
||||
if (!file1.exists() || !file2.exists()) {
|
||||
// 两个文件都不存在判断其路径是否相同, 对于一个存在一个不存在的情况,一定不相同
|
||||
return ! file1.exists()//
|
||||
&& ! file2.exists()//
|
||||
return !file1.exists()//
|
||||
&& !file2.exists()//
|
||||
&& pathEquals(file1, file2);
|
||||
}
|
||||
return equals(file1.toPath(), file2.toPath());
|
||||
@ -1238,7 +1238,7 @@ public class FileUtil extends PathUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! file1Exists) {
|
||||
if (!file1Exists) {
|
||||
// 两个文件都不存在,返回true
|
||||
return true;
|
||||
}
|
||||
@ -1383,7 +1383,7 @@ public class FileUtil extends PathUtil {
|
||||
* @return 是否被改动
|
||||
*/
|
||||
public static boolean isModified(final File file, final long lastModifyTime) {
|
||||
if (null == file || ! file.exists()) {
|
||||
if (null == file || !file.exists()) {
|
||||
return true;
|
||||
}
|
||||
return file.lastModified() != lastModifyTime;
|
||||
@ -2654,7 +2654,7 @@ public class FileUtil extends PathUtil {
|
||||
parentCanonicalPath = parentFile.getAbsolutePath();
|
||||
canonicalPath = file.getAbsolutePath();
|
||||
}
|
||||
if (! canonicalPath.startsWith(parentCanonicalPath)) {
|
||||
if (!canonicalPath.startsWith(parentCanonicalPath)) {
|
||||
throw new IllegalArgumentException("New file is outside of the parent dir: " + file.getName());
|
||||
}
|
||||
}
|
||||
@ -2802,7 +2802,7 @@ public class FileUtil extends PathUtil {
|
||||
private static File buildFile(File outFile, String fileName) {
|
||||
// 替换Windows路径分隔符为Linux路径分隔符,便于统一处理
|
||||
fileName = fileName.replace(CharUtil.BACKSLASH, CharUtil.SLASH);
|
||||
if (! isWindows()
|
||||
if (!isWindows()
|
||||
// 检查文件名中是否包含"/",不考虑以"/"结尾的情况
|
||||
&& fileName.lastIndexOf(CharUtil.SLASH, fileName.length() - 2) > 0) {
|
||||
// 在Linux下多层目录创建存在问题,/会被当成文件名的一部分,此处做处理
|
||||
|
@ -401,7 +401,7 @@ public class FileWriter extends FileWrapper {
|
||||
*/
|
||||
private void checkFile() throws IORuntimeException {
|
||||
Assert.notNull(file, "File to write content is null !");
|
||||
if (this.file.exists() && ! file.isFile()) {
|
||||
if (this.file.exists() && !file.isFile()) {
|
||||
throw new IORuntimeException("File [{}] is not a file !", this.file.getAbsoluteFile());
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class PathCopier extends SrcToDestCopier<Path, PathCopier> {
|
||||
*/
|
||||
public PathCopier(final Path src, final Path target, final CopyOption[] options) {
|
||||
Assert.notNull(target, "Src path must be not null !");
|
||||
if (! PathUtil.exists(src, false)) {
|
||||
if (!PathUtil.exists(src, false)) {
|
||||
throw new IllegalArgumentException("Src path is not exist!");
|
||||
}
|
||||
this.src = src;
|
||||
|
@ -66,7 +66,7 @@ public class PathMover {
|
||||
*/
|
||||
public PathMover(final Path src, final Path target, final CopyOption[] options) {
|
||||
Assert.notNull(target, "Src path must be not null !");
|
||||
if(! PathUtil.exists(src, false)){
|
||||
if(!PathUtil.exists(src, false)){
|
||||
throw new IllegalArgumentException("Src path is not exist!");
|
||||
}
|
||||
this.src = src;
|
||||
|
@ -41,7 +41,7 @@ public class PathUtil {
|
||||
*/
|
||||
public static boolean isDirEmpty(final Path dirPath) {
|
||||
try (final DirectoryStream<Path> dirStream = Files.newDirectoryStream(dirPath)) {
|
||||
return ! dirStream.iterator().hasNext();
|
||||
return !dirStream.iterator().hasNext();
|
||||
} catch (final IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
@ -73,9 +73,9 @@ public class PathUtil {
|
||||
public static List<File> loopFiles(final Path path, final int maxDepth, final FileFilter fileFilter) {
|
||||
final List<File> fileList = new ArrayList<>();
|
||||
|
||||
if (null == path || ! Files.exists(path)) {
|
||||
if (null == path || !Files.exists(path)) {
|
||||
return fileList;
|
||||
} else if (! isDirectory(path)) {
|
||||
} else if (!isDirectory(path)) {
|
||||
final File file = path.toFile();
|
||||
if (null == fileFilter || fileFilter.accept(file)) {
|
||||
fileList.add(file);
|
||||
@ -223,7 +223,7 @@ public class PathUtil {
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public static boolean isExistsAndNotDirectory(final Path path, final boolean isFollowLinks) {
|
||||
return exists(path, isFollowLinks) && ! isDirectory(path, isFollowLinks);
|
||||
return exists(path, isFollowLinks) && !isDirectory(path, isFollowLinks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -576,7 +576,7 @@ public class PathUtil {
|
||||
* @since 5.5.7
|
||||
*/
|
||||
public static Path mkdir(final Path dir) {
|
||||
if (null != dir && ! exists(dir, false)) {
|
||||
if (null != dir && !exists(dir, false)) {
|
||||
try {
|
||||
Files.createDirectories(dir);
|
||||
} catch (final IOException e) {
|
||||
|
@ -137,7 +137,7 @@ public class Tailer implements Serializable {
|
||||
this.period, TimeUnit.MILLISECONDS//
|
||||
);
|
||||
|
||||
if (! async) {
|
||||
if (!async) {
|
||||
try {
|
||||
scheduledFuture.get();
|
||||
} catch (final ExecutionException e) {
|
||||
@ -206,7 +206,7 @@ public class Tailer implements Serializable {
|
||||
}
|
||||
|
||||
// 输出缓存栈中的内容
|
||||
while (! stack.isEmpty()) {
|
||||
while (!stack.isEmpty()) {
|
||||
this.lineHandler.accept(stack.pop());
|
||||
}
|
||||
}
|
||||
@ -225,10 +225,10 @@ public class Tailer implements Serializable {
|
||||
* @param file 文件
|
||||
*/
|
||||
private static void checkFile(final File file) {
|
||||
if (! file.exists()) {
|
||||
if (!file.exists()) {
|
||||
throw new UtilException("File [{}] not exist !", file.getAbsolutePath());
|
||||
}
|
||||
if (! file.isFile()) {
|
||||
if (!file.isFile()) {
|
||||
throw new UtilException("Path [{}] is not a file !", file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class CopyVisitor extends SimpleFileVisitor<Path> {
|
||||
* @param copyOptions 拷贝选项,如跳过已存在等
|
||||
*/
|
||||
public CopyVisitor(final Path source, final Path target, final CopyOption... copyOptions) {
|
||||
if (PathUtil.exists(target, false) && ! PathUtil.isDirectory(target)) {
|
||||
if (PathUtil.exists(target, false) && !PathUtil.isDirectory(target)) {
|
||||
throw new IllegalArgumentException("Target must be a directory");
|
||||
}
|
||||
this.source = source;
|
||||
@ -70,7 +70,7 @@ public class CopyVisitor extends SimpleFileVisitor<Path> {
|
||||
try {
|
||||
Files.copy(dir, targetDir, copyOptions);
|
||||
} catch (final FileAlreadyExistsException e) {
|
||||
if (! Files.isDirectory(targetDir)) {
|
||||
if (!Files.isDirectory(targetDir)) {
|
||||
// 目标文件存在抛出异常,目录忽略
|
||||
throw e;
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class CopyVisitor extends SimpleFileVisitor<Path> {
|
||||
* 初始化目标文件或目录
|
||||
*/
|
||||
private void initTargetDir() {
|
||||
if (! this.isTargetCreated) {
|
||||
if (!this.isTargetCreated) {
|
||||
PathUtil.mkdir(this.target);
|
||||
this.isTargetCreated = true;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class MoveVisitor extends SimpleFileVisitor<Path> {
|
||||
* @param copyOptions 拷贝(移动)选项
|
||||
*/
|
||||
public MoveVisitor(final Path source, final Path target, final CopyOption... copyOptions) {
|
||||
if(PathUtil.exists(target, false) && ! PathUtil.isDirectory(target)){
|
||||
if(PathUtil.exists(target, false) && !PathUtil.isDirectory(target)){
|
||||
throw new IllegalArgumentException("Target must be a directory");
|
||||
}
|
||||
this.source = source;
|
||||
@ -59,9 +59,9 @@ public class MoveVisitor extends SimpleFileVisitor<Path> {
|
||||
initTarget();
|
||||
// 将当前目录相对于源路径转换为相对于目标路径
|
||||
final Path targetDir = target.resolve(source.relativize(dir));
|
||||
if(! Files.exists(targetDir)){
|
||||
if(!Files.exists(targetDir)){
|
||||
Files.createDirectories(targetDir);
|
||||
} else if(! Files.isDirectory(targetDir)){
|
||||
} else if(!Files.isDirectory(targetDir)){
|
||||
throw new FileAlreadyExistsException(targetDir.toString());
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
@ -79,7 +79,7 @@ public class MoveVisitor extends SimpleFileVisitor<Path> {
|
||||
* 初始化目标文件或目录
|
||||
*/
|
||||
private void initTarget(){
|
||||
if(! this.isTargetCreated){
|
||||
if(!this.isTargetCreated){
|
||||
PathUtil.mkdir(this.target);
|
||||
this.isTargetCreated = true;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class BOMInputStream extends InputStream {
|
||||
* @return 编码
|
||||
*/
|
||||
public String getCharset() {
|
||||
if (! isInited) {
|
||||
if (!isInited) {
|
||||
try {
|
||||
init();
|
||||
} catch (final IOException ex) {
|
||||
|
@ -53,7 +53,7 @@ public class SyncInputStream extends FilterInputStream {
|
||||
super(in);
|
||||
this.length = length;
|
||||
this.isIgnoreEOFError = isIgnoreEOFError;
|
||||
if (! isAsync) {
|
||||
if (!isAsync) {
|
||||
sync();
|
||||
}
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class SyncInputStream extends FilterInputStream {
|
||||
try {
|
||||
copyLength = IoUtil.copy(this.in, out, IoUtil.DEFAULT_BUFFER_SIZE, this.length, streamProgress);
|
||||
} catch (final IORuntimeException e) {
|
||||
if (! (isIgnoreEOFError && isEOFException(e.getCause()))) {
|
||||
if (!(isIgnoreEOFError && isEOFException(e.getCause()))) {
|
||||
throw e;
|
||||
}
|
||||
// 忽略读取流中的EOF错误
|
||||
|
@ -302,13 +302,13 @@ public class WatchMonitor extends WatchServer {
|
||||
@Override
|
||||
public void init() throws WatchException {
|
||||
//获取目录或文件路径
|
||||
if (! PathUtil.exists(this.path, false)) {
|
||||
if (!PathUtil.exists(this.path, false)) {
|
||||
// 不存在的路径
|
||||
final Path lastPathEle = FileUtil.getLastPathEle(this.path);
|
||||
if (null != lastPathEle) {
|
||||
final String lastPathEleStr = lastPathEle.toString();
|
||||
//带有点表示有扩展名,按照未创建的文件对待。Linux下.d的为目录,排除之
|
||||
if (StrUtil.contains(lastPathEleStr, CharUtil.DOT) && ! StrUtil.endWithIgnoreCase(lastPathEleStr, ".d")) {
|
||||
if (StrUtil.contains(lastPathEleStr, CharUtil.DOT) && !StrUtil.endWithIgnoreCase(lastPathEleStr, ".d")) {
|
||||
this.filePath = this.path;
|
||||
this.path = this.filePath.getParent();
|
||||
}
|
||||
@ -364,7 +364,7 @@ public class WatchMonitor extends WatchServer {
|
||||
registerPath();
|
||||
// log.debug("Start watching path: [{}]", this.path);
|
||||
|
||||
while (! isClosed) {
|
||||
while (!isClosed) {
|
||||
doTakeAndWatch(watcher);
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class WatchServer extends Thread implements Closeable, Serializable {
|
||||
});
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
if (! (e instanceof AccessDeniedException)) {
|
||||
if (!(e instanceof AccessDeniedException)) {
|
||||
throw new WatchException(e);
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ public class WatchServer extends Thread implements Closeable, Serializable {
|
||||
|
||||
for (final WatchEvent<?> event : wk.pollEvents()) {
|
||||
// 如果监听文件,检查当前事件是否与所监听文件关联
|
||||
if (null != watchFilter && ! watchFilter.test(event)) {
|
||||
if (null != watchFilter && !watchFilter.test(event)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class Assert {
|
||||
* @throws X if expression is {@code false}
|
||||
*/
|
||||
public static <X extends Throwable> void isTrue(final boolean expression, final Supplier<? extends X> supplier) throws X {
|
||||
if (! expression) {
|
||||
if (!expression) {
|
||||
throw supplier.get();
|
||||
}
|
||||
}
|
||||
@ -701,7 +701,7 @@ public class Assert {
|
||||
*/
|
||||
public static <T> T isInstanceOf(final Class<?> type, final T obj, final String errorMsgTemplate, final Object... params) throws IllegalArgumentException {
|
||||
notNull(type, "Type to check against must not be null");
|
||||
if (! type.isInstance(obj)) {
|
||||
if (!type.isInstance(obj)) {
|
||||
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
|
||||
}
|
||||
return obj;
|
||||
@ -755,7 +755,7 @@ public class Assert {
|
||||
* @throws IllegalStateException 表达式为 {@code false} 抛出此异常
|
||||
*/
|
||||
public static void state(final boolean expression, final Supplier<String> errorMsgSupplier) throws IllegalStateException {
|
||||
if (! expression) {
|
||||
if (!expression) {
|
||||
throw new IllegalStateException(errorMsgSupplier.get());
|
||||
}
|
||||
}
|
||||
@ -772,7 +772,7 @@ public class Assert {
|
||||
* @throws IllegalStateException 表达式为 {@code false} 抛出此异常
|
||||
*/
|
||||
public static void state(final boolean expression, final String errorMsgTemplate, final Object... params) throws IllegalStateException {
|
||||
if (! expression) {
|
||||
if (!expression) {
|
||||
throw new IllegalStateException(StrUtil.format(errorMsgTemplate, params));
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class Validator {
|
||||
* @since 4.4.5
|
||||
*/
|
||||
public static boolean isFalse(final boolean value) {
|
||||
return ! value;
|
||||
return !value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,7 +235,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static Object validateEqual(final Object t1, final Object t2, final String errorMsg) throws ValidateException {
|
||||
if (! equal(t1, t2)) {
|
||||
if (!equal(t1, t2)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return t1;
|
||||
@ -297,7 +297,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateMatchRegex(final String regex, final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isMatchRegex(regex, value)) {
|
||||
if (!isMatchRegex(regex, value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -345,7 +345,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateGeneral(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isGeneral(value)) {
|
||||
if (!isGeneral(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -382,7 +382,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateGeneral(final T value, final int min, final int max, final String errorMsg) throws ValidateException {
|
||||
if (! isGeneral(value, min, max)) {
|
||||
if (!isGeneral(value, min, max)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -435,7 +435,7 @@ public class Validator {
|
||||
* @since 3.3.0
|
||||
*/
|
||||
public static <T extends CharSequence> T validateLetter(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isLetter(value)) {
|
||||
if (!isLetter(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -463,7 +463,7 @@ public class Validator {
|
||||
* @since 3.3.0
|
||||
*/
|
||||
public static <T extends CharSequence> T validateUpperCase(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isUpperCase(value)) {
|
||||
if (!isUpperCase(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -491,7 +491,7 @@ public class Validator {
|
||||
* @since 3.3.0
|
||||
*/
|
||||
public static <T extends CharSequence> T validateLowerCase(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isLowerCase(value)) {
|
||||
if (!isLowerCase(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -527,7 +527,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static String validateNumber(final String value, final String errorMsg) throws ValidateException {
|
||||
if (! isNumber(value)) {
|
||||
if (!isNumber(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -555,7 +555,7 @@ public class Validator {
|
||||
* @since 4.1.8
|
||||
*/
|
||||
public static <T extends CharSequence> T validateWord(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isWord(value)) {
|
||||
if (!isWord(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -581,7 +581,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateMoney(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isMoney(value)) {
|
||||
if (!isMoney(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -608,7 +608,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateZipCode(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isZipCode(value)) {
|
||||
if (!isZipCode(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -634,7 +634,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateEmail(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isEmail(value)) {
|
||||
if (!isEmail(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -660,7 +660,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateMobile(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isMobile(value)) {
|
||||
if (!isMobile(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -686,7 +686,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateCitizenIdNumber(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isCitizenId(value)) {
|
||||
if (!isCitizenId(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -762,7 +762,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateBirthday(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isBirthday(value)) {
|
||||
if (!isBirthday(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -788,7 +788,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateIpv4(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isIpv4(value)) {
|
||||
if (!isIpv4(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -814,7 +814,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateIpv6(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isIpv6(value)) {
|
||||
if (!isIpv6(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -842,7 +842,7 @@ public class Validator {
|
||||
* @since 4.1.3
|
||||
*/
|
||||
public static <T extends CharSequence> T validateMac(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isMac(value)) {
|
||||
if (!isMac(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -870,7 +870,7 @@ public class Validator {
|
||||
* @since 3.0.6
|
||||
*/
|
||||
public static <T extends CharSequence> T validatePlateNumber(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isPlateNumber(value)) {
|
||||
if (!isPlateNumber(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -904,7 +904,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateUrl(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isUrl(value)) {
|
||||
if (!isUrl(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -941,7 +941,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateChinese(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isChinese(value)) {
|
||||
if (!isChinese(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -967,7 +967,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateGeneralWithChinese(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isGeneralWithChinese(value)) {
|
||||
if (!isGeneralWithChinese(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -995,7 +995,7 @@ public class Validator {
|
||||
* @throws ValidateException 验证异常
|
||||
*/
|
||||
public static <T extends CharSequence> T validateUUID(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isUUID(value)) {
|
||||
if (!isUUID(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -1023,7 +1023,7 @@ public class Validator {
|
||||
* @since 4.3.3
|
||||
*/
|
||||
public static <T extends CharSequence> T validateHex(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isHex(value)) {
|
||||
if (!isHex(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -1057,7 +1057,7 @@ public class Validator {
|
||||
* @since 4.1.10
|
||||
*/
|
||||
public static void validateBetween(final Number value, final Number min, final Number max, final String errorMsg) throws ValidateException {
|
||||
if (! isBetween(value, min, max)) {
|
||||
if (!isBetween(value, min, max)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
}
|
||||
@ -1077,7 +1077,7 @@ public class Validator {
|
||||
Assert.notNull(start);
|
||||
Assert.notNull(end);
|
||||
|
||||
if (! DateUtil.isIn(value, start, end)) {
|
||||
if (!DateUtil.isIn(value, start, end)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
}
|
||||
@ -1124,7 +1124,7 @@ public class Validator {
|
||||
* @since 5.6.3
|
||||
*/
|
||||
public static <T extends CharSequence> T validateCarVin(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isCarVin(value)) {
|
||||
if (!isCarVin(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
@ -1191,7 +1191,7 @@ public class Validator {
|
||||
* @since 5.6.3
|
||||
*/
|
||||
public static <T extends CharSequence> T validateCarDrivingLicence(final T value, final String errorMsg) throws ValidateException {
|
||||
if (! isCarDrivingLicence(value)) {
|
||||
if (!isCarDrivingLicence(value)) {
|
||||
throw new ValidateException(errorMsg);
|
||||
}
|
||||
return value;
|
||||
|
@ -80,7 +80,7 @@ public class CallerUtil {
|
||||
public static String getCallerMethodName(final boolean isFullName){
|
||||
final StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[2];
|
||||
final String methodName = stackTraceElement.getMethodName();
|
||||
if(! isFullName){
|
||||
if(!isFullName){
|
||||
return methodName;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class ObjectId {
|
||||
* @return objectId
|
||||
*/
|
||||
public static String next(final boolean withHyphen) {
|
||||
if (! withHyphen) {
|
||||
if (!withHyphen) {
|
||||
return next();
|
||||
}
|
||||
final char[] ids = new char[26];
|
||||
|
@ -359,22 +359,22 @@ public class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||
final StringBuilder builder = StrUtil.builder(isSimple ? 32 : 36);
|
||||
// time_low
|
||||
builder.append(digits(mostSigBits >> 32, 8));
|
||||
if (! isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// time_mid
|
||||
builder.append(digits(mostSigBits >> 16, 4));
|
||||
if (! isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// time_high_and_version
|
||||
builder.append(digits(mostSigBits, 4));
|
||||
if (! isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// variant_and_sequence
|
||||
builder.append(digits(leastSigBits >> 48, 4));
|
||||
if (! isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// node
|
||||
|
@ -44,7 +44,7 @@ public abstract class AtomicLoader<T> implements Loader<T>, Serializable {
|
||||
|
||||
if (result == null) {
|
||||
result = init();
|
||||
if (! reference.compareAndSet(null, result)) {
|
||||
if (!reference.compareAndSet(null, result)) {
|
||||
// 其它线程已经创建好此对象
|
||||
result = reference.get();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class MutableEntry<K, V> extends AbsEntry<K, V> implements Mutable<Map.En
|
||||
* @param value 值
|
||||
* @param <K> 键类型
|
||||
* @param <V> 值类型
|
||||
* @return
|
||||
* @return {@code MutableEntry}
|
||||
*/
|
||||
public static <K, V> MutableEntry<K, V> of(final K key, final V value) {
|
||||
return new MutableEntry<>(key, value);
|
||||
|
@ -70,7 +70,7 @@ public class NavigatePageInfo extends PageInfo {
|
||||
public String toString() {
|
||||
final StringBuilder str = new StringBuilder();
|
||||
|
||||
if (! isFirstPage()) {
|
||||
if (!isFirstPage()) {
|
||||
str.append("<< ");
|
||||
}
|
||||
if (navigatePageNumbers.length > 0) {
|
||||
@ -79,7 +79,7 @@ public class NavigatePageInfo extends PageInfo {
|
||||
for (int i = 1; i < navigatePageNumbers.length; i++) {
|
||||
str.append(" ").append(wrapForDisplay(navigatePageNumbers[i]));
|
||||
}
|
||||
if (! isLastPage()) {
|
||||
if (!isLastPage()) {
|
||||
str.append(" >>");
|
||||
}
|
||||
return str.toString();
|
||||
|
@ -311,7 +311,7 @@ public class BoundedRange<T extends Comparable<? super T>> implements Predicate<
|
||||
// 上界小于下界时为空
|
||||
return compareValue > 0
|
||||
// 上下界的边界值相等,且不为退化区间是为空
|
||||
|| ! (low.getType().isClose() && up.getType().isClose());
|
||||
|| !(low.getType().isClose() && up.getType().isClose());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ public class BoundedRangeOperation {
|
||||
* @return 是否相交
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> boolean isIntersected(final BoundedRange<T> boundedRange, final BoundedRange<T> other) {
|
||||
return ! isDisjoint(boundedRange, other);
|
||||
return !isDisjoint(boundedRange, other);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +129,7 @@ public class Range<T> implements Iterable<T>, Iterator<T>, Serializable {
|
||||
}
|
||||
if (null == this.next) {
|
||||
return false;
|
||||
} else if (! includeEnd && this.next.equals(this.end)) {
|
||||
} else if (!includeEnd && this.next.equals(this.end)) {
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
@ -142,7 +142,7 @@ public class Range<T> implements Iterable<T>, Iterator<T>, Serializable {
|
||||
public T next() {
|
||||
lock.lock();
|
||||
try {
|
||||
if (! this.hasNext()) {
|
||||
if (!this.hasNext()) {
|
||||
throw new NoSuchElementException("Has no next range!");
|
||||
}
|
||||
return nextUncheck();
|
||||
@ -158,7 +158,7 @@ public class Range<T> implements Iterable<T>, Iterator<T>, Serializable {
|
||||
final T current;
|
||||
if(0 == this.index){
|
||||
current = start;
|
||||
if(! this.includeStart){
|
||||
if(!this.includeStart){
|
||||
// 获取下一组元素
|
||||
index ++;
|
||||
return nextUncheck();
|
||||
|
@ -304,7 +304,7 @@ public class LinkedForestMap<K, V> implements ForestMap<K, V> {
|
||||
}
|
||||
|
||||
// 3.子节点存在,但是未与其他节点构成父子关系
|
||||
if (! childNode.hasParent()) {
|
||||
if (!childNode.hasParent()) {
|
||||
parentNode.addChild(childNode);
|
||||
}
|
||||
// 4.子节点存在,且已经与其他节点构成父子关系,但是允许子节点直接修改其父节点
|
||||
|
@ -152,7 +152,7 @@ public class MapProxy implements Map<Object, Object>, TypeGetter<Object>, Invoca
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(fieldName)) {
|
||||
if (! this.containsKey(fieldName)) {
|
||||
if (!this.containsKey(fieldName)) {
|
||||
// 驼峰不存在转下划线尝试
|
||||
fieldName = StrUtil.toUnderlineCase(fieldName);
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ public class MapUtil extends MapGetUtil {
|
||||
*/
|
||||
public static <K, V> String join(final Map<K, V> map, final String separator, final String keyValueSeparator,
|
||||
final boolean isIgnoreNull, final String... otherParams) {
|
||||
return join(map, separator, keyValueSeparator, (entry) -> ! isIgnoreNull || entry.getKey() != null && entry.getValue() != null, otherParams);
|
||||
return join(map, separator, keyValueSeparator, (entry) -> !isIgnoreNull || entry.getKey() != null && entry.getValue() != null, otherParams);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,7 +95,7 @@ public class TolerantMap<K, V> extends MapWrapper<K, V> {
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
if (! super.equals(o)) {
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
final TolerantMap<?, ?> that = (TolerantMap<?, ?>) o;
|
||||
|
@ -1329,7 +1329,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean contains(final Object obj) {
|
||||
if (! (obj instanceof Entry)) {
|
||||
if (!(obj instanceof Entry)) {
|
||||
return false;
|
||||
}
|
||||
final Entry<K, Node<K, V>> entry = (Entry<K, Node<K, V>>) obj;
|
||||
|
@ -168,7 +168,7 @@ public abstract class AbsTable<R, C, V> implements Table<R, C, V> {
|
||||
|
||||
@Override
|
||||
public Cell<R, C, V> next() {
|
||||
if (! columnIterator.hasNext()) {
|
||||
if (!columnIterator.hasNext()) {
|
||||
rowEntry = rowIterator.next();
|
||||
columnIterator = rowEntry.getValue().entrySet().iterator();
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ public class RowKeyTable<R, C, V> extends AbsTable<R, C, V> {
|
||||
while (true) {
|
||||
if (entryIterator.hasNext()) {
|
||||
final Map.Entry<C, V> entry = entryIterator.next();
|
||||
if (! seen.containsKey(entry.getKey())) {
|
||||
if (!seen.containsKey(entry.getKey())) {
|
||||
seen.put(entry.getKey(), entry.getValue());
|
||||
return entry.getKey();
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class Arrangement implements Serializable {
|
||||
*/
|
||||
private void select(final String[] datas, final String[] resultList, final int resultIndex, final List<String[]> result) {
|
||||
if (resultIndex >= resultList.length) { // 全部选择完时,输出排列结果
|
||||
if (! result.contains(resultList)) {
|
||||
if (!result.contains(resultList)) {
|
||||
result.add(Arrays.copyOf(resultList, resultList.length));
|
||||
}
|
||||
return;
|
||||
|
@ -51,9 +51,9 @@ public class Calculator {
|
||||
final Stack<String> resultStack = new Stack<>();
|
||||
Collections.reverse(postfixStack);// 将后缀式栈反转
|
||||
String firstValue, secondValue, currentOp;// 参与计算的第一个值,第二个值和算术运算符
|
||||
while (! postfixStack.isEmpty()) {
|
||||
while (!postfixStack.isEmpty()) {
|
||||
currentOp = postfixStack.pop();
|
||||
if (! isOperator(currentOp.charAt(0))) {// 如果不是运算符则存入操作数栈中
|
||||
if (!isOperator(currentOp.charAt(0))) {// 如果不是运算符则存入操作数栈中
|
||||
currentOp = currentOp.replace("~", "-");
|
||||
resultStack.push(currentOp);
|
||||
} else {// 如果是运算符则从操作数栈中取两个值和该数值一起参与运算
|
||||
|
@ -42,7 +42,7 @@ public class Combination implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算组合数,即C(n, m) = n!/((n-m)! * m!)
|
||||
* 计算组合数,即C(n, m) = n!/((n-m)!* m!)
|
||||
*
|
||||
* @param n 总数
|
||||
* @param m 选择的个数
|
||||
|
@ -80,7 +80,7 @@ public class MathUtil {
|
||||
|
||||
//--------------------------------------------------------------------------------------------- Combination
|
||||
/**
|
||||
* 计算组合数,即C(n, m) = n!/((n-m)! * m!)
|
||||
* 计算组合数,即C(n, m) = n!/((n-m)!* m!)
|
||||
*
|
||||
* @param n 总数
|
||||
* @param m 选择的个数
|
||||
@ -128,7 +128,7 @@ public class MathUtil {
|
||||
/**
|
||||
* 计算阶乘
|
||||
* <p>
|
||||
* n! = n * (n-1) * ... * 2 * 1
|
||||
* n!= n * (n-1) * ... * 2 * 1
|
||||
* </p>
|
||||
*
|
||||
* @param n 阶乘起始
|
||||
@ -219,7 +219,7 @@ public class MathUtil {
|
||||
/**
|
||||
* 计算阶乘
|
||||
* <p>
|
||||
* n! = n * (n-1) * ... * 2 * 1
|
||||
* n!= n * (n-1) * ... * 2 * 1
|
||||
* </p>
|
||||
*
|
||||
* @param n 阶乘起始
|
||||
|
@ -738,7 +738,7 @@ public class NumberUtil {
|
||||
// two E's
|
||||
return false;
|
||||
}
|
||||
if (! foundDigit) {
|
||||
if (!foundDigit) {
|
||||
return false;
|
||||
}
|
||||
hasExp = true;
|
||||
@ -783,7 +783,7 @@ public class NumberUtil {
|
||||
}
|
||||
// allowSigns is true iff the val ends in 'E'
|
||||
// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass
|
||||
return ! allowSigns && foundDigit;
|
||||
return !allowSigns && foundDigit;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -802,7 +802,7 @@ public class NumberUtil {
|
||||
* @see Integer#decode(String)
|
||||
*/
|
||||
public static boolean isInteger(final String s) {
|
||||
if (! isNumber(s)) {
|
||||
if (!isNumber(s)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@ -830,7 +830,7 @@ public class NumberUtil {
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public static boolean isLong(final String s) {
|
||||
if (! isNumber(s)) {
|
||||
if (!isNumber(s)) {
|
||||
return false;
|
||||
}
|
||||
final char lastChar = s.charAt(s.length() - 1);
|
||||
@ -1776,9 +1776,9 @@ public class NumberUtil {
|
||||
return false;
|
||||
}
|
||||
if (number instanceof Double) {
|
||||
return (! ((Double) number).isInfinite()) && (! ((Double) number).isNaN());
|
||||
return (!((Double) number).isInfinite()) && (!((Double) number).isNaN());
|
||||
} else if (number instanceof Float) {
|
||||
return (! ((Float) number).isInfinite()) && (! ((Float) number).isNaN());
|
||||
return (!((Float) number).isInfinite()) && (!((Float) number).isNaN());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1792,7 +1792,7 @@ public class NumberUtil {
|
||||
* @since 5.7.0
|
||||
*/
|
||||
public static boolean isValid(final double number) {
|
||||
return ! (Double.isNaN(number) || Double.isInfinite(number));
|
||||
return !(Double.isNaN(number) || Double.isInfinite(number));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1804,7 +1804,7 @@ public class NumberUtil {
|
||||
* @since 5.7.0
|
||||
*/
|
||||
public static boolean isValid(final float number) {
|
||||
return ! (Float.isNaN(number) || Float.isInfinite(number));
|
||||
return !(Float.isNaN(number) || Float.isInfinite(number));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1859,6 +1859,6 @@ public class NumberUtil {
|
||||
* @since 5.7.17
|
||||
*/
|
||||
public static boolean isEven(final int num) {
|
||||
return ! isOdd(num);
|
||||
return !isOdd(num);
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public class Ipv4Util implements Ipv4Pool {
|
||||
Assert.isTrue(maskBit > IPV4_MASK_BIT_VALID_MIN && maskBit <= IPV4_MASK_BIT_MAX,
|
||||
"Not support mask bit: {}", maskBit);
|
||||
//如果掩码位等于32,则可用地址为0
|
||||
if (maskBit == IPV4_MASK_BIT_MAX && ! isAll) {
|
||||
if (maskBit == IPV4_MASK_BIT_MAX && !isAll) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class LocalPortGenerator implements Serializable{
|
||||
public int generate() {
|
||||
int validPort = alternativePort.get();
|
||||
// 获取可用端口
|
||||
while (! NetUtil.isUsableLocalPort(validPort)) {
|
||||
while (!NetUtil.isUsableLocalPort(validPort)) {
|
||||
validPort = alternativePort.incrementAndGet();
|
||||
}
|
||||
return validPort;
|
||||
|
@ -141,7 +141,7 @@ public class NetUtil {
|
||||
* @return 是否可用
|
||||
*/
|
||||
public static boolean isUsableLocalPort(final int port) {
|
||||
if (! isValidPort(port)) {
|
||||
if (!isValidPort(port)) {
|
||||
// 给定的IP未在指定端口范围中
|
||||
return false;
|
||||
}
|
||||
@ -473,7 +473,7 @@ public class NetUtil {
|
||||
|
||||
while (networkInterfaces.hasMoreElements()) {
|
||||
final NetworkInterface networkInterface = networkInterfaces.nextElement();
|
||||
if (networkInterfaceFilter != null && ! networkInterfaceFilter.test(networkInterface)) {
|
||||
if (networkInterfaceFilter != null && !networkInterfaceFilter.test(networkInterface)) {
|
||||
continue;
|
||||
}
|
||||
final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
|
||||
@ -525,7 +525,7 @@ public class NetUtil {
|
||||
public static InetAddress getLocalhost() {
|
||||
final LinkedHashSet<InetAddress> localAddressList = localAddressList(address -> {
|
||||
// 非loopback地址,指127.*.*.*的地址
|
||||
return ! address.isLoopbackAddress()
|
||||
return !address.isLoopbackAddress()
|
||||
// 需为IPV4地址
|
||||
&& address instanceof Inet4Address;
|
||||
});
|
||||
@ -533,7 +533,7 @@ public class NetUtil {
|
||||
if (CollUtil.isNotEmpty(localAddressList)) {
|
||||
InetAddress address2 = null;
|
||||
for (final InetAddress inetAddress : localAddressList) {
|
||||
if (! inetAddress.isSiteLocalAddress()) {
|
||||
if (!inetAddress.isSiteLocalAddress()) {
|
||||
// 非地区本地地址,指10.0.0.0 ~ 10.255.255.255、172.16.0.0 ~ 172.31.255.255、192.168.0.0 ~ 192.168.255.255
|
||||
return inetAddress;
|
||||
} else if (null == address2) {
|
||||
@ -761,7 +761,7 @@ public class NetUtil {
|
||||
if (ip != null && StrUtil.indexOf(ip, CharUtil.COMMA) > 0) {
|
||||
final List<String> ips = SplitUtil.splitTrim(ip, StrUtil.COMMA);
|
||||
for (final String subIp : ips) {
|
||||
if (! isUnknown(subIp)) {
|
||||
if (!isUnknown(subIp)) {
|
||||
ip = subIp;
|
||||
break;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class UploadFile {
|
||||
if(null == this.tempFile){
|
||||
throw new NullPointerException("Temp file is null !");
|
||||
}
|
||||
if(! this.tempFile.exists()){
|
||||
if(!this.tempFile.exists()){
|
||||
throw new NoSuchFileException("Temp file: [" + this.tempFile.getAbsolutePath() + "] not exist!");
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ public class UploadFile {
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
private void assertValid() throws IOException {
|
||||
if (! isUploaded()) {
|
||||
if (!isUploaded()) {
|
||||
throw new IOException(StrUtil.format("File [{}] upload fail", getFileName()));
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user