mirror of
https://gitee.com/jzsw-it/yexuejc-base.git
synced 2025-06-06 22:04:04 +08:00
1.3.8 ToUeProperty 增加 ignore
This commit is contained in:
parent
873bfcbe9f
commit
70c4fb67b1
@ -1,6 +1,13 @@
|
||||
yexuejc-base 更新记录
|
||||
------------------
|
||||
|
||||
#### version :1.3.8
|
||||
**time:2019-1-11 13:28:12** <br/>
|
||||
**branch:** master <br/>
|
||||
**update:** <br/>
|
||||
>1. [ToUeProperty](src/main/java/com/yexuejc/base/util/ToUeProperty.java) 增加 ignore
|
||||
#
|
||||
|
||||
#### version :1.3.7
|
||||
**time:2019-1-11 10:02:03** <br/>
|
||||
**branch:** master <br/>
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>top.yexuejc</groupId>
|
||||
<artifactId>yexuejc-base</artifactId>
|
||||
<version>1.3.7</version>
|
||||
<version>1.3.8</version>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<url>https://github.com/yexuejc/yexuejc-base</url>
|
||||
|
@ -109,13 +109,19 @@ public class ObjUtil {
|
||||
fName = StrUtil.camelToUnderline(f.getName());
|
||||
}
|
||||
boolean annotationPresent = f.isAnnotationPresent(ToUeProperty.class);
|
||||
boolean ignore = false;
|
||||
if (annotationPresent) {
|
||||
ToUeProperty annotation = f.getAnnotation(ToUeProperty.class);
|
||||
ignore = annotation.ignore();
|
||||
String value = annotation.value();
|
||||
if (StrUtil.isNotEmpty(value)) {
|
||||
fName = value;
|
||||
}
|
||||
}
|
||||
//忽略
|
||||
if (ignore) {
|
||||
continue;
|
||||
}
|
||||
Object o = f.get(obj);
|
||||
if (null == o || isPrimitive(o) || o instanceof String || o instanceof Enum) {
|
||||
if (null == o && !putNull) {
|
||||
@ -175,15 +181,13 @@ public class ObjUtil {
|
||||
boolean b = obj.getClass().isPrimitive()
|
||||
|| obj instanceof Integer || obj instanceof Character || obj instanceof Boolean
|
||||
|| obj instanceof Number || obj instanceof String || obj instanceof Double || obj instanceof Float
|
||||
|| obj instanceof Short || obj instanceof Long || obj instanceof Byte || obj instanceof Date
|
||||
;
|
||||
|| obj instanceof Short || obj instanceof Long || obj instanceof Byte || obj instanceof Date;
|
||||
if (b) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
B a = new B();
|
||||
a.nameFirst = "张三";
|
||||
@ -251,7 +255,6 @@ public class ObjUtil {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <h2>深度克隆对象</h2>
|
||||
* <p>
|
||||
|
@ -11,4 +11,10 @@ public @interface ToUeProperty {
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* 是否忽略该字段,默认false
|
||||
* @return
|
||||
*/
|
||||
boolean ignore() default false;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user