|
8 | 8 | /** @author Daniel Bechler */ |
9 | 9 | public class Configuration |
10 | 10 | { |
| 11 | + private Collection<String> ignoreCategories = new TreeSet<String>(); |
11 | 12 | private Collection<PropertyPath> ignoreProperties = new LinkedHashSet<PropertyPath>(10); |
12 | 13 | private Collection<PropertyPath> equalsOnlyProperties = new LinkedHashSet<PropertyPath>(10); |
13 | 14 | private Collection<Class<?>> equalsOnlyTypes = new LinkedHashSet<Class<?>>(10); |
| 15 | + private boolean returnUnchangedNodes = false; |
| 16 | + private boolean returnIgnoredNodes = false; |
| 17 | + |
| 18 | + public Collection<String> getIgnoreCategories() |
| 19 | + { |
| 20 | + return Collections.unmodifiableCollection(ignoreCategories); |
| 21 | + } |
| 22 | + |
| 23 | + public void setIgnoreCategories(final Collection<String> ignoreCategories) |
| 24 | + { |
| 25 | + this.ignoreCategories = ignoreCategories; |
| 26 | + } |
| 27 | + |
| 28 | + public void addIgnoreCategories(final String... category) |
| 29 | + { |
| 30 | + this.ignoreCategories.addAll(Arrays.asList(category)); |
| 31 | + } |
14 | 32 |
|
15 | 33 | public Collection<PropertyPath> getIgnoreProperties() |
16 | 34 | { |
@@ -57,39 +75,41 @@ public void addEqualsOnlyType(final Class<?> type) |
57 | 75 | this.equalsOnlyTypes.add(type); |
58 | 76 | } |
59 | 77 |
|
60 | | - public boolean isIgnored(final PropertyPath propertyPath) |
| 78 | + public boolean isEqualsOnlyPath(final PropertyPath selectorPath) |
61 | 79 | { |
62 | | - return ignoreProperties.contains(propertyPath); |
| 80 | + return equalsOnlyProperties.contains(selectorPath); |
63 | 81 | } |
64 | 82 |
|
65 | | - public boolean isEqualsOnly(final PropertyPath propertyPath, final Class<?> propertyType) |
| 83 | + public boolean isEqualsOnlyType(final Class<?> type) |
66 | 84 | { |
67 | | - if (isEqualsOnlyPath(propertyPath)) |
| 85 | + if (type.getAnnotation(ObjectDiffEqualsOnlyType.class) != null) |
68 | 86 | { |
69 | 87 | return true; |
70 | 88 | } |
71 | | - else if (isEqualsOnlyType(propertyType)) |
| 89 | + else if (equalsOnlyTypes.contains(type)) |
72 | 90 | { |
73 | 91 | return true; |
74 | 92 | } |
75 | 93 | return false; |
76 | 94 | } |
77 | 95 |
|
78 | | - public boolean isEqualsOnlyPath(final PropertyPath selectorPath) |
| 96 | + public boolean isReturnIgnoredNodes() |
79 | 97 | { |
80 | | - return equalsOnlyProperties.contains(selectorPath); |
| 98 | + return returnIgnoredNodes; |
81 | 99 | } |
82 | 100 |
|
83 | | - public boolean isEqualsOnlyType(final Class<?> propertyType) |
| 101 | + public void setReturnIgnoredNodes(final boolean returnIgnoredNodes) |
84 | 102 | { |
85 | | - if (propertyType.getAnnotation(ObjectDiffEqualsOnlyType.class) != null) |
86 | | - { |
87 | | - return true; |
88 | | - } |
89 | | - else if (equalsOnlyTypes.contains(propertyType)) |
90 | | - { |
91 | | - return true; |
92 | | - } |
93 | | - return false; |
| 103 | + this.returnIgnoredNodes = returnIgnoredNodes; |
| 104 | + } |
| 105 | + |
| 106 | + public boolean isReturnUnchangedNodes() |
| 107 | + { |
| 108 | + return returnUnchangedNodes; |
| 109 | + } |
| 110 | + |
| 111 | + public void setReturnUnchangedNodes(final boolean returnUnchangedNodes) |
| 112 | + { |
| 113 | + this.returnUnchangedNodes = returnUnchangedNodes; |
94 | 114 | } |
95 | 115 | } |
0 commit comments