public interface GraphObject
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.
Modifier and Type | Interface and Description |
---|---|
static class |
GraphObject.Factory
Creates proxies that implement GraphObject, GraphObjectList, and their derived types.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
asMap()
Returns a Java Collections map of names and properties.
|
<T extends GraphObject> |
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
|
<T extends GraphObject> |
getPropertyAs(String propertyName,
Class<T> graphObjectClass)
Gets a property of the GraphObject, cast to a particular GraphObject-derived interface.
|
<T extends GraphObject> |
getPropertyAsList(String propertyName,
Class<T> graphObjectClass)
Gets a property of the GraphObject, cast to a a list of instances of a particular GraphObject-derived interface.
|
void |
removeProperty(String propertyName)
Removes a property of the GraphObject
|
void |
setProperty(String propertyName,
Object propertyValue)
Sets a property of the GraphObject
|
<T extends GraphObject> T cast(Class<T> graphObjectClass)
graphObjectClass
- the type of GraphObject to returnMap<String,Object> asMap()
JSONObject getInnerJSONObject()
Object getProperty(String propertyName)
propertyName
- the name of the property to get<T extends GraphObject> T getPropertyAs(String propertyName, Class<T> graphObjectClass)
propertyName
- the name of the property to getgraphObjectClass
- the GraphObject-derived interface to cast the property to<T extends GraphObject> GraphObjectList<T> getPropertyAsList(String propertyName, Class<T> graphObjectClass)
propertyName
- the name of the property to getgraphObjectClass
- the GraphObject-derived interface to cast the property to a list ofvoid setProperty(String propertyName, Object propertyValue)
propertyName
- the name of the property to setpropertyValue
- the value of the named property to setvoid removeProperty(String propertyName)
propertyName
- the name of the property to remove