com.parse.ParseTraverser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parse-android Show documentation
Show all versions of parse-android Show documentation
A library that gives you access to the powerful Parse cloud platform from your Android app.
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.parse;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Subclass ParseTraverser to make an function to be run recursively on every object pointed to on
* the given object.
*/
/** package */ abstract class ParseTraverser {
// Whether to recurse into ParseObjects that are seen.
private boolean traverseParseObjects;
// Whether to call visit with the object passed in.
private boolean yieldRoot;
/**
* Creates a new ParseTraverser.
*/
public ParseTraverser() {
traverseParseObjects = false;
yieldRoot = false;
}
/**
* Override this method to implement your own functionality.
* @return true if you want the Traverser to continue. false if you want it to cancel.
*/
protected abstract boolean visit(Object object);
/**
* Internal implementation of traverse.
*/
private void traverseInternal(Object root, boolean yieldRoot, IdentityHashMap