本文整理匯總了Java中com.facebook.internal.Validate.containsNoNulls方法的典型用法代碼示例。如果您正苦於以下問題:Java Validate.containsNoNulls方法的具體用法?Java Validate.containsNoNulls怎麽用?Java Validate.containsNoNulls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.internal.Validate
的用法示例。
在下文中一共展示了Validate.containsNoNulls方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addAttachmentsForCall
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* Adds a number of bitmap attachments associated with a native app call. The attachments will be
* served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
*
* @param context the Context the call is being made from
* @param callId the unique ID of the call
* @param imageAttachments a Map of attachment names to Bitmaps; the attachment names will be part of
* the URI processed by openFile
* @throws java.io.IOException
*/
public void addAttachmentsForCall(Context context, UUID callId, Map<String, Bitmap> imageAttachments) {
Validate.notNull(context, "context");
Validate.notNull(callId, "callId");
Validate.containsNoNulls(imageAttachments.values(), "imageAttachments");
Validate.containsNoNullOrEmpty(imageAttachments.keySet(), "imageAttachments");
addAttachments(context, callId, imageAttachments, new ProcessAttachment<Bitmap>() {
@Override
public void processAttachment(Bitmap attachment, File outputFile) throws IOException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
attachment.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
} finally {
Utility.closeQuietly(outputStream);
}
}
});
}
示例2: addAttachmentFilesForCall
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* Adds a number of bitmap attachment files associated with a native app call. The attachments will be
* served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
*
* @param context the Context the call is being made from
* @param callId the unique ID of the call
* @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
* part of the URI processed by openFile
* @throws java.io.IOException
*/
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
Validate.notNull(context, "context");
Validate.notNull(callId, "callId");
Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");
addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
@Override
public void processAttachment(File attachment, File outputFile) throws IOException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(attachment);
byte[] buffer = new byte[1024];
int len;
while ((len = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, len);
}
} finally {
Utility.closeQuietly(outputStream);
Utility.closeQuietly(inputStream);
}
}
});
}
示例3: setImageAttachmentsForObject
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
* prior to publishing the action. The images may be marked as being
* user-generated -- refer to
* <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
* for more information.
* The action must already have been set prior to calling this method, and
* the action must have a GraphObject-valued property with the specified property name. This method will
* generate unique names for the image attachments and update the graph object to refer to these
* attachments. Note that calling setObject again after calling this method, or modifying the value of the
* specified property, will not clear the image attachments already set, but the new action (or objects)
* will have no reference to the existing attachments.</p>
* <p/>
* <p>In order for the images to be provided to the Facebook application as part of the app call, the
* NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
*
* @param objectProperty the name of a property on the action that corresponds to an Open Graph object;
* the object must be marked as a new object to be created
* (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
* true) or an exception will be thrown
* @param objectProperty the name of a property on the action that corresponds to an Open Graph object
* @param bitmaps a list of Files containing bitmaps to be uploaded and attached to the Open Graph object
* @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
* @return this instance of the builder
*/
public CONCRETE setImageAttachmentsForObject(String objectProperty, List<Bitmap> bitmaps,
boolean isUserGenerated) {
Validate.notNull(objectProperty, "objectProperty");
Validate.containsNoNulls(bitmaps, "bitmaps");
if (action == null) {
throw new FacebookException("Can not set attachments prior to setting action.");
}
List<String> attachmentUrls = addImageAttachments(bitmaps);
updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);
@SuppressWarnings("unchecked")
CONCRETE result = (CONCRETE) this;
return result;
}
示例4: setImageAttachmentFilesForObject
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
* prior to publishing the action. The images may be marked as being
* user-generated -- refer to
* <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
* for more information.
* The action must already have been set prior to calling this method, and
* the action must have a GraphObject-valued property with the specified property name. This method will
* generate unique names for the image attachments and update the graph object to refer to these
* attachments. Note that calling setObject again after calling this method, or modifying the value of the
* specified property, will not clear the image attachments already set, but the new action (or objects)
* will have no reference to the existing attachments.</p>
* <p/>
* <p>In order for the images to be provided to the Facebook application as part of the app call, the
* NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
*
* @param objectProperty the name of a property on the action that corresponds to an Open Graph object;
* the object must be marked as a new object to be created
* (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
* true) or an exception will be thrown
* @param bitmapFiles a list of Bitmaps to be uploaded and attached to the Open Graph object
* @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
* @return this instance of the builder
*/
public CONCRETE setImageAttachmentFilesForObject(String objectProperty,
List<File> bitmapFiles, boolean isUserGenerated) {
Validate.notNull(objectProperty, "objectProperty");
Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
if (action == null) {
throw new FacebookException("Can not set attachments prior to setting action.");
}
List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);
@SuppressWarnings("unchecked")
CONCRETE result = (CONCRETE) this;
return result;
}
示例5: setImageAttachmentsForAction
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
* action. The action must already have been set prior to calling this method. This method will generate unique
* names for the image attachments and update the action to refer to these attachments. Note that calling
* setAction again after calling this method will not clear the image attachments already set, but the new
* action will have no reference to the existing attachments. The images may be marked as being
* user-generated -- refer to
* <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
* for more information.</p>
* <p/>
* <p>In order for the images to be provided to the Facebook application as part of the app call, the
* NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
*
* @param bitmaps a list of Bitmaps to be uploaded and attached to the Open Graph action
* @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
* @return this instance of the builder
*/
public CONCRETE setImageAttachmentsForAction(List<Bitmap> bitmaps,
boolean isUserGenerated) {
Validate.containsNoNulls(bitmaps, "bitmaps");
if (action == null) {
throw new FacebookException("Can not set attachments prior to setting action.");
}
List<String> attachmentUrls = addImageAttachments(bitmaps);
updateActionAttachmentUrls(attachmentUrls, isUserGenerated);
@SuppressWarnings("unchecked")
CONCRETE result = (CONCRETE) this;
return result;
}
示例6: setImageAttachmentFilesForAction
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
* action. The action must already have been set prior to calling this method. The images may be marked as being
* user-generated -- refer to
* <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
* for more information. This method will generate unique
* names for the image attachments and update the action to refer to these attachments. Note that calling
* setAction again after calling this method will not clear the image attachments already set, but the new
* action will have no reference to the existing attachments.</p>
* <p/>
* <p>In order for the images to be provided to the Facebook application as part of the app call, the
* NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
*
* @param bitmapFiles a list of Files containing bitmaps to be uploaded and attached to the Open Graph action
* @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
* @return this instance of the builder
*/
public CONCRETE setImageAttachmentFilesForAction(List<File> bitmapFiles,
boolean isUserGenerated) {
Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
if (action == null) {
throw new FacebookException("Can not set attachments prior to setting action.");
}
List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
updateActionAttachmentUrls(attachmentUrls, isUserGenerated);
@SuppressWarnings("unchecked")
CONCRETE result = (CONCRETE) this;
return result;
}