com.facebook.model
Interface GraphObject

All Known Subinterfaces:
GraphLocation, GraphMultiResult, GraphPlace, GraphUser, OpenGraphAction

public interface GraphObject

GraphObject is the primary interface used by the Facebook SDK for Android to represent objects in the Facebook Social Graph and the Facebook Open Graph (OG). It is the base interface for all typed access to graph objects in the SDK. No concrete classes implement GraphObject or its derived interfaces. Rather, they are implemented as proxies (see the Factory class) that provide strongly-typed property getters and setters to access the underlying data. Since the primary use case for graph objects is sending and receiving them over the wire to/from Facebook services, they are represented as JSONObjects. No validation is done that a graph object is actually of a specific type -- any graph object can be treated as any GraphObject-derived interface, and the presence or absence of specific properties determines its suitability for use as that particular type of object.


Nested Class Summary
static class GraphObject.Factory
          Creates proxies that implement GraphObject, GraphObjectList, and their derived types.
 
Method Summary
 Map<String,Object> asMap()
          Returns a Java Collections map of names and properties.
<T extends GraphObject>
T
cast(Class<T> graphObjectClass)
          Returns a new proxy that treats this graph object as a different GraphObject-derived type.
 JSONObject getInnerJSONObject()
          Gets the underlying JSONObject representation of this graph object.
 Object getProperty(String propertyName)
          Gets a property of the GraphObject
 void removeProperty(String propertyName)
          Removes a property of the GraphObject
 void setProperty(String propertyName, Object propertyValue)
          Sets a property of the GraphObject
 

Method Detail

cast

<T extends GraphObject> T cast(Class<T> graphObjectClass)
Returns a new proxy that treats this graph object as a different GraphObject-derived type.

Parameters:
graphObjectClass - the type of GraphObject to return
Returns:
a new instance of the GraphObject-derived-type that references the same underlying data

asMap

Map<String,Object> asMap()
Returns a Java Collections map of names and properties. Modifying the returned map modifies the inner JSON representation.

Returns:
a Java Collections map representing the GraphObject state

getInnerJSONObject

JSONObject getInnerJSONObject()
Gets the underlying JSONObject representation of this graph object.

Returns:
the underlying JSONObject representation of this graph object

getProperty

Object getProperty(String propertyName)
Gets a property of the GraphObject

Parameters:
propertyName - the name of the property to get
Returns:
the value of the named property

setProperty

void setProperty(String propertyName,
                 Object propertyValue)
Sets a property of the GraphObject

Parameters:
propertyName - the name of the property to set
propertyValue - the value of the named property to set

removeProperty

void removeProperty(String propertyName)
Removes a property of the GraphObject

Parameters:
propertyName - the name of the property to remove