public class RemoveElementsJsonAction extends Object implements JSONTraverseAction
JSONObject.
An element is not removed from the user-specified list once its processing is over, because it may appear in more than one node.
See package-info for more details
See unit tests for examples
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowDotChar |
protected Map<String,Object> |
elementsToRemove |
protected net.minidev.json.JSONObject |
result |
| Constructor and Description |
|---|
RemoveElementsJsonAction(Map<String,Object> elementsToRemove) |
RemoveElementsJsonAction(Map<String,Object> elementsToRemove,
boolean allowDotChar) |
| 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
|
protected net.minidev.json.JSONObject result
protected final boolean allowDotChar
public RemoveElementsJsonAction(Map<String,Object> elementsToRemove, boolean allowDotChar)
public boolean start(net.minidev.json.JSONObject object)
TreeTraverseActionM tree startsstart in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>public boolean removeEntry(String fullPathToEntry, Map.Entry<String,Object> entry)
TreeTraverseActionM 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)
TreeTraverseActiontraverseEntry in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>public boolean recurInto(String pathToEntry, net.minidev.json.JSONObject entryValue)
TreeTraverseActionrecurInto in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>public boolean recurInto(String pathToEntry, net.minidev.json.JSONArray entryValue)
TreeTraverseActionrecurInto in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>public void handleLeaf(String pathToEntry, Map.Entry<String,Object> entry)
TreeTraverseActionM map is encounteredhandleLeaf in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>public void handleLeaf(String fullPathToContainingList, int listIndex, Object listItem)
TreeTraverseActionL 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()
TreeTraverseActionresult in interface TreeTraverseAction<net.minidev.json.JSONObject,net.minidev.json.JSONArray>Copyright © 2017 Chemouni Uriel. All rights reserved.