Commit 85defa2d authored by Matija Obreza's avatar Matija Obreza

Merge branch 'ui-252-explore-filter-suggestions' into 'master'

Added method for clearing one of Filter fields

See merge request genesys-pgr/application-blocks!48
parents b5f664b8 843d1e75
......@@ -92,6 +92,28 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
}
}
public void clearFilter(String jsonPath) throws NoSuchFieldException, IllegalAccessException {
String[] paths = jsonPath.split("\\.");
Object toClear = this;
Class<?> clazz = this.getClass();
Field field = clazz.getField(paths[0]);
for (int i = 1; i < paths.length; i++) {
clazz = field.getType();
if (!BasicModelFilter.class.isAssignableFrom(clazz))
break;
toClear = field.get(toClear);
if (toClear == null)
return;
field = clazz.getField(paths[i]);
}
field.set(toClear, null);
}
// @Override
// public int hashCode() {
// String str = toString();
......
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