Commit 61e0b5f0 authored by Maxym Borodenko's avatar Maxym Borodenko

Extended clearFilters functionality

parent 2476d560
...@@ -110,6 +110,10 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten ...@@ -110,6 +110,10 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
} }
public void clearFilter(String jsonPath) throws NoSuchFieldException, IllegalAccessException { public void clearFilter(String jsonPath) throws NoSuchFieldException, IllegalAccessException {
this.clearFilter(jsonPath, true);
}
public void clearFilter(String jsonPath, boolean clearNullAndNotNull) throws NoSuchFieldException, IllegalAccessException {
String[] paths = jsonPath.split("\\."); String[] paths = jsonPath.split("\\.");
Object toClear = this; Object toClear = this;
...@@ -128,13 +132,15 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten ...@@ -128,13 +132,15 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
field = clazz.getField(paths[i]); field = clazz.getField(paths[i]);
} }
if (this.NULL != null) { if (clearNullAndNotNull) {
this.NULL.remove(jsonPath); if (this.NULL != null) {
} this.NULL.remove(jsonPath);
if (this.NOTNULL != null) { }
this.NOTNULL.remove(jsonPath); if (this.NOTNULL != null) {
this.NOTNULL.remove(jsonPath);
}
} }
field.set(toClear, null); field.set(toClear, null);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment