Skip to content

Commit

Permalink
[android-sdk] Moved GraphObjectWrapper to GraphObject.Factory.
Browse files Browse the repository at this point in the history
Summary:
GraphObjectWrapper had a name that did not clearly indicate its purpose. It is really a factory for GraphObjects,
and as such it makes sense to nest it within GraphObject and call it Factory. This commit does that, and also shortens
some of its method names, since it is clear from context now what they are creating.

Fixed a warning in WebDialog.java.

Test Plan:
- Built all projects
- Ran unit tests

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mingfli

CC: ekoneil, caabernathy, platform-diffs@lists, security-diffs@lists

Differential Revision: https://phabricator.fb.com/D632163
  • Loading branch information
Chris Lang committed Nov 15, 2012
1 parent 1de146b commit d49eae9
Show file tree
Hide file tree
Showing 18 changed files with 784 additions and 796 deletions.
6 changes: 3 additions & 3 deletions facebook/src/com/facebook/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import android.content.Context;
import com.facebook.model.GraphObject;
import com.facebook.model.GraphObjectList;
import com.facebook.model.GraphObjectWrapper;
import com.facebook.internal.CacheableRequestBatch;
import com.facebook.internal.FileLruCache;
import com.facebook.internal.Logger;
Expand Down Expand Up @@ -416,9 +415,10 @@ private static Response createResponseFromObject(Request request, HttpURLConnect
GraphObject graphObject = null;
GraphObjectList<GraphObject> graphObjectList = null;
if (body instanceof JSONObject) {
graphObject = GraphObjectWrapper.createGraphObject((JSONObject) body);
graphObject = GraphObject.Factory.create((JSONObject) body);
} else if (body instanceof JSONArray) {
graphObjectList = GraphObjectWrapper.createGraphObjectList((JSONArray) body, GraphObject.class);
graphObjectList = GraphObject.Factory
.createList((JSONArray) body, GraphObject.class);
}
return new Response(request, connection, graphObject, graphObjectList, isFromCache);
} else if (object == JSONObject.NULL) {
Expand Down
3 changes: 1 addition & 2 deletions facebook/src/com/facebook/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import android.os.Bundle;
import com.facebook.android.Util;
import com.facebook.model.GraphObject;
import com.facebook.model.GraphObjectWrapper;
import com.facebook.internal.Validate;
import org.json.JSONException;

Expand Down Expand Up @@ -249,7 +248,7 @@ public static boolean publishInstallAndWait(final Context context, final String
}

if ((Boolean)doesSupportAttribution) {
GraphObject publishParams = GraphObjectWrapper.createGraphObject();
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
publishParams.setProperty(ATTRIBUTION_KEY, attributionId);

Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* Provides a strongly-typed representation of a Location as defined by the Graph API.
*
* Note that this interface is intended to be used with GraphObjectWrapper
* Note that this interface is intended to be used with GraphObject.Factory
* and not implemented directly.
*/
public interface GraphLocation extends GraphObject {
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphMultiResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Defines a GraphObject that represents the result of a query that returns multiple GraphObjects
* nested under a "data" property.
*
* Note that this interface is intended to be used with GraphObjectWrapper
* Note that this interface is intended to be used with GraphObject.Factory
* and not implemented directly.
*/
public interface GraphMultiResult extends GraphObject {
Expand Down
669 changes: 667 additions & 2 deletions facebook/src/com/facebook/model/GraphObject.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphObjectList.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/**
* GraphObjectList is the primary representation of a collection of graph objects in the Facebook SDK for Android.
* It is not implemented by any concrete classes, but rather by a proxy (see the {@link GraphObjectWrapper GraphObjectWrapper}
* It is not implemented by any concrete classes, but rather by a proxy (see the {@link com.facebook.model.GraphObject.Factory Factory}
* class). A GraphObjectList can actually contain elements of any type, not just graph objects, but its principal
* use in the SDK is to contain types derived from GraphObject.
* <br/>
Expand Down
Loading

0 comments on commit d49eae9

Please sign in to comment.