public class RemovePathsJsonAction extends Object implements JSONTraverseAction
JSONObject
.
A path is not removed from the user-specified list once its processing is over, because identical objects in the same array are supported by this action.
See package-info for more details
See unit tests for examples
Modifier and Type | Field and Description |
---|---|
protected List<String> |
pathsToRemove |
protected net.minidev.json.JSONObject |
result |
Constructor and Description |
---|
RemovePathsJsonAction(List<String> pathsToRemove) |
Modifier and Type | Method and Description |
---|---|
void |
end()
called after the traversal ends,
and just before the
#start(M) method exits |
void |
handleLeaf(String fullPathToContainingList,
int listIndex,
Object listItem)
called for each leaf of an
L list is encountered |
void |
handleLeaf(String pathToEntry,
Map.Entry<String,Object> entry)
called for each leaf of an
M map is encountered |
boolean |
recurInto(String pathToEntry,
net.minidev.json.JSONArray entryValue)
called when a non-leaf item is encountered inside an object
|
boolean |
recurInto(String pathToEntry,
net.minidev.json.JSONObject entryValue)
called when a non-leaf entry is encountered inside an object
|
boolean |
removeEntry(String fullPathToEntry,
Map.Entry<String,Object> entry)
the last callback for each entry in an
M map. |
Object |
result()
holds the result of the traversal,
as assigned by the action implementing this interface
|
boolean |
start(net.minidev.json.JSONObject object)
called before any traversal of the
M tree starts |
boolean |
traverseEntry(String fullPathToEntry,
Map.Entry<String,Object> entry)
called when a new entry is encountered and before any processing is performed on it
|
public boolean start(net.minidev.json.JSONObject object)
TreeTraverseAction
M
tree startsstart
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
public boolean removeEntry(String fullPathToEntry, Map.Entry<String,Object> entry)
TreeTraverseAction
M
map. if this method returns true
the TreeTraverser
removes the entry from the map. there is no further
handling of the entry.removeEntry
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
M
treepublic boolean traverseEntry(String fullPathToEntry, Map.Entry<String,Object> entry)
TreeTraverseAction
traverseEntry
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
public boolean recurInto(String pathToEntry, net.minidev.json.JSONObject entryValue)
TreeTraverseAction
recurInto
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
public boolean recurInto(String pathToEntry, net.minidev.json.JSONArray entryValue)
TreeTraverseAction
recurInto
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
public void handleLeaf(String pathToEntry, Map.Entry<String,Object> entry)
TreeTraverseAction
M
map is encounteredhandleLeaf
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
public void handleLeaf(String fullPathToContainingList, int listIndex, Object listItem)
TreeTraverseAction
L
list is encounteredhandleLeaf
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
listIndex
- - the ordered location of the item in the listlistItem
- - the itempublic void end()
TreeTraverseAction
#start(M)
method exitsend
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
public Object result()
TreeTraverseAction
result
in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>
Copyright © 2020 Chemouni Uriel. All rights reserved.