GraphObject
이 클래스는 더 이상 최신 버전의 SDK에서 사용할 수 없습니다.
이 클래스의 최신 버전을 사용할 수 있습니다. 확인해보세요 최신 버전.

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.

패키지:model
인스턴스 메서드
cast(Class)

Returns a new proxy that treats this graph object as a different GraphObject-derived type.

public GraphObject cast(Class graphObjectClass)
매개변수설명
graphObjectClassThe type of GraphObject to return
Returns
A new instance of the GraphObject-derived-type that references the same underlying data
asMap()

Returns a Java Collections map of names and properties. Modifying the returned map modifies the inner JSON representation.

public Map asMap()
Returns
A Java Collections map representing the GraphObject state
getInnerJSONObject()

Gets the underlying JSONObject representation of this graph object.

public JSONObject getInnerJSONObject()
Returns
The underlying JSONObject representation of this graph object
getProperty(String)

Gets a property of the GraphObject

public Object getProperty(String propertyName)
매개변수설명
propertyNameThe name of the property to get
Returns
The value of the named property
getPropertyAs(String, Class)

Gets a property of the GraphObject, cast to a particular GraphObject-derived interface. This gives some of the benefits of having a property getter defined to return a GraphObject-derived type without requiring explicit definition of an interface to define the getter.

public GraphObject getPropertyAs(String propertyName, Class graphObjectClass)
매개변수설명
propertyNameThe name of the property to get
graphObjectClassThe GraphObject-derived interface to cast the property to
getPropertyAsList(String, Class)

Gets a property of the GraphObject, cast to a a list of instances of a particular GraphObject-derived interface. This gives some of the benefits of having a property getter defined to return a GraphObject-derived type without requiring explicit definition of an interface to define the getter.

public GraphObjectList getPropertyAsList(String propertyName, Class graphObjectClass)
매개변수설명
propertyNameThe name of the property to get
graphObjectClassThe GraphObject-derived interface to cast the property to a list of
setProperty(String, Object)

Sets a property of the GraphObject

public void setProperty(String propertyName, Object propertyValue)
매개변수설명
propertyNameThe name of the property to set
propertyValueThe value of the named property to set
removeProperty(String)

Removes a property of the GraphObject

public void removeProperty(String propertyName)
매개변수설명
propertyNameThe name of the property to remove