From 727e167a3af2c78ba32ae9d75edd5272948ad130 Mon Sep 17 00:00:00 2001 From: dadiyang Date: Sat, 6 Jun 2020 16:19:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=B8=8D=E5=90=8C=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AF=B9=E8=B1=A1=E7=9A=84=E6=AF=94=E5=AF=B9;?= =?UTF-8?q?=E6=AF=94=E5=8C=85=E5=90=AB=E7=88=B6=E7=B1=BB=E5=AD=97=E6=AE=B5?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/github/dadiyang/equator/AbstractEquator.java | 5 ++++- .../java/com/github/dadiyang/equator/FieldBaseEquator.java | 2 +- .../java/com/github/dadiyang/equator/GetterBaseEquator.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/dadiyang/equator/AbstractEquator.java b/src/main/java/com/github/dadiyang/equator/AbstractEquator.java index 1f9d2fc..40b6a58 100644 --- a/src/main/java/com/github/dadiyang/equator/AbstractEquator.java +++ b/src/main/java/com/github/dadiyang/equator/AbstractEquator.java @@ -146,7 +146,10 @@ boolean isSimpleField(Object first, Object second) { return clazz.isPrimitive() || WRAPPER.contains(clazz); } - Set getAllFields(Set firstFields, Set secondFields) { + /** + * 根据配置的规则决定取两个对象字段的交集或并集 + */ + Set getAllFieldNames(Set firstFields, Set secondFields) { Set allFields; // 只取交集 if (isBothExistFieldOnly()) { diff --git a/src/main/java/com/github/dadiyang/equator/FieldBaseEquator.java b/src/main/java/com/github/dadiyang/equator/FieldBaseEquator.java index 40d6889..6a98b1a 100644 --- a/src/main/java/com/github/dadiyang/equator/FieldBaseEquator.java +++ b/src/main/java/com/github/dadiyang/equator/FieldBaseEquator.java @@ -55,7 +55,7 @@ public List getDiffFields(Object first, Object second) { } else if (second == null) { allFieldNames = firstFields.keySet(); } else { - allFieldNames = getAllFields(firstFields.keySet(), secondFields.keySet()); + allFieldNames = getAllFieldNames(firstFields.keySet(), secondFields.keySet()); } List diffFields = new LinkedList<>(); for (String fieldName : allFieldNames) { diff --git a/src/main/java/com/github/dadiyang/equator/GetterBaseEquator.java b/src/main/java/com/github/dadiyang/equator/GetterBaseEquator.java index ae7003e..450a14d 100644 --- a/src/main/java/com/github/dadiyang/equator/GetterBaseEquator.java +++ b/src/main/java/com/github/dadiyang/equator/GetterBaseEquator.java @@ -75,7 +75,7 @@ public List getDiffFields(Object first, Object second) { } else if (second == null) { allFieldNames = firstGetters.keySet(); } else { - allFieldNames = getAllFields(firstGetters.keySet(), secondGetters.keySet()); + allFieldNames = getAllFieldNames(firstGetters.keySet(), secondGetters.keySet()); } List diffFields = new LinkedList<>(); for (String fieldName : allFieldNames) {