本文整理匯總了Java中com.facebook.model.GraphObjectList.add方法的典型用法代碼示例。如果您正苦於以下問題:Java GraphObjectList.add方法的具體用法?Java GraphObjectList.add怎麽用?Java GraphObjectList.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.model.GraphObjectList
的用法示例。
在下文中一共展示了GraphObjectList.add方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createGetPermissionsRequest
import com.facebook.model.GraphObjectList; //導入方法依賴的package包/類
@Override
Request createGetPermissionsRequest(String accessToken) {
final List<String> permissions = permissionsToReport;
return new MockRequest() {
@Override
public Response createResponse() {
GraphObject permissionsObject = GraphObject.Factory.create();
if (permissions != null) {
for (String permission : permissions) {
permissionsObject.setProperty(permission, 1);
}
}
GraphObjectList<GraphObject> data = GraphObject.Factory.createList(GraphObject.class);
data.add(permissionsObject);
GraphMultiResult result = GraphObject.Factory.create(GraphMultiResult.class);
result.setProperty("data", data);
return new Response(this, null, result, false);
}
};
}
示例2: createGetPermissionsRequest
import com.facebook.model.GraphObjectList; //導入方法依賴的package包/類
@Override
Request createGetPermissionsRequest(String accessToken) {
final List<String> permissions = permissionsToReport;
return new MockRequest() {
@Override
public Response createResponse() {
GraphObject permissionsObject = GraphObject.Factory.create();
if (permissions != null) {
for (String permission : permissions) {
permissionsObject.setProperty(permission, 1);
}
}
GraphObjectList<GraphObject> data = GraphObject.Factory.createList(GraphObject.class);
data.add(permissionsObject);
GraphMultiResult result = GraphObject.Factory.create(GraphMultiResult.class);
result.setProperty("data", data);
return new Response(this, null, null, result, false);
}
};
}
示例3: updateObjectAttachmentUrls
import com.facebook.model.GraphObjectList; //導入方法依賴的package包/類
void updateObjectAttachmentUrls(String objectProperty, List<String> attachmentUrls, boolean isUserGenerated) {
final OpenGraphObject object;
try {
object = action.getPropertyAs(objectProperty, OpenGraphObject.class);
if (object == null) {
throw new IllegalArgumentException("Action does not contain a property '" + objectProperty + "'");
}
} catch (FacebookGraphObjectException exception) {
throw new IllegalArgumentException("Property '" + objectProperty + "' is not a graph object");
}
if (!object.getCreateObject()) {
throw new IllegalArgumentException(
"The Open Graph object in '" + objectProperty + "' is not marked for creation");
}
GraphObjectList<GraphObject> attachments = object.getImage();
if (attachments == null) {
attachments = GraphObject.Factory.createList(GraphObject.class);
}
for (String url : attachmentUrls) {
GraphObject graphObject = GraphObject.Factory.create();
graphObject.setProperty(NativeProtocol.IMAGE_URL_KEY, url);
if (isUserGenerated) {
graphObject.setProperty(NativeProtocol.IMAGE_USER_GENERATED_KEY, true);
}
attachments.add(graphObject);
}
object.setImage(attachments);
}