Package org.czeal.jsonfilter
Interface Filter
-
- All Known Implementing Classes:
ExclusionFilter,InclusionFilter
public interface FilterA filter interface for processing JSON elements by either including or excluding specified nodes.Implementations of this interface define how filtering is applied to a given JSON structure based on a set of rules provided in a string format.
The filtering rules are specified as a comma-separated string where nested fields can be defined using parentheses. Implementations may use this structure to determine whether elements should be retained or removed from the resulting JSON.
Example
"a,b(c,d)"- Includes/excludes top-level elementaand the sub-elementscanddinsideb."x(y)"- Includes/excludes onlyx.y, keeping other elements inx.
Implementing classes may vary in behavior, such as including only specified elements (inclusion filtering) or removing specified elements (exclusion filtering).
- Author:
- Hideki Ikeda
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.google.gson.JsonElementapply(com.google.gson.JsonElement source, String nodes)Applies the filtering strategy to the targetsourcebased on the givennodes.
-
-
-
Method Detail
-
apply
com.google.gson.JsonElement apply(com.google.gson.JsonElement source, String nodes)Applies the filtering strategy to the targetsourcebased on the givennodes.- Parameters:
source- The source JSON element to filter.nodes- A comma-separated string defining allowed JSON nodes to include. Each node can specify nested fields using parentheses.- Returns:
- A new
JsonElementinstance built by filtering thesourceobject based on the givennodesstring.
-
-