本文整理了Java中com.facebook.internal.Validate.notNullOrEmpty()
方法的一些代码示例,展示了Validate.notNullOrEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Validate.notNullOrEmpty()
方法的具体详情如下:
包路径:com.facebook.internal.Validate
类名称:Validate
方法名:notNullOrEmpty
暂无
代码示例来源:origin: facebook/facebook-android-sdk
public Logger(LoggingBehavior behavior, String tag) {
Validate.notNullOrEmpty(tag, "tag");
this.behavior = behavior;
this.tag = LOG_TAG_BASE + tag;
this.contents = new StringBuilder();
}
代码示例来源:origin: facebook/facebook-android-sdk
/**
* Sets the list of friends for pre selection. These friends will be selected by default.
* @param graphUsers list of friends as GraphUsers
*/
public void setSelection(List<JSONObject> graphUsers) {
List<String> userIds = new ArrayList<String>();
for(JSONObject graphUser: graphUsers) {
String id = graphUser.optString("id");
Validate.notNullOrEmpty(id, "id");
userIds.add(id);
}
setSelectionByIds(userIds);
}
代码示例来源:origin: facebook/facebook-android-sdk
public static Uri getProfilePictureUri(
String userId,
int width,
int height) {
Validate.notNullOrEmpty(userId, "userId");
width = Math.max(width, UNSPECIFIED_DIMENSION);
height = Math.max(height, UNSPECIFIED_DIMENSION);
if (width == UNSPECIFIED_DIMENSION && height == UNSPECIFIED_DIMENSION) {
throw new IllegalArgumentException("Either width or height must be greater than 0");
}
Uri.Builder builder =
Uri.parse(ServerProtocol.getGraphUrlBase())
.buildUpon()
.path(String.format(
Locale.US, PATH,
FacebookSdk.getGraphApiVersion(),
userId));
if (height != UNSPECIFIED_DIMENSION) {
builder.appendQueryParameter(HEIGHT_PARAM, String.valueOf(height));
}
if (width != UNSPECIFIED_DIMENSION) {
builder.appendQueryParameter(WIDTH_PARAM, String.valueOf(width));
}
builder.appendQueryParameter(MIGRATION_PARAM, MIGRATION_VALUE);
return builder.build();
}
代码示例来源:origin: facebook/facebook-android-sdk
/**
* Constructor that builds a dialog without an authenticated user.
*
* @param context the Context within which the dialog will be shown.
* @param applicationId the application ID to be included in the dialog URL.
* @param action the portion of the dialog URL following www.facebook.com/dialog/.
* See https://developers.facebook.com/docs/reference/dialogs/ for details.
* @param parameters a Bundle containing parameters to pass as part of the URL.
*/
public Builder(Context context, String applicationId, String action, Bundle parameters) {
if (applicationId == null) {
applicationId = Utility.getMetadataApplicationId(context);
}
Validate.notNullOrEmpty(applicationId, "applicationId");
this.applicationId = applicationId;
finishInit(context, action, parameters);
}
代码示例来源:origin: facebook/facebook-android-sdk
@Test
public void testNotNullOrEmptyOnNull() {
try {
Validate.notNullOrEmpty(null, "name");
fail("expected exception");
} catch (Exception e) {
}
}
代码示例来源:origin: facebook/facebook-android-sdk
@Test
public void testNotNullOrEmptyOnEmpty() {
try {
Validate.notNullOrEmpty("", "name");
fail("expected exception");
} catch (Exception e) {
}
}
代码示例来源:origin: facebook/facebook-android-sdk
@Test
public void testNotNullOrEmptyOnNonEmpty() {
Validate.notNullOrEmpty("hi", "name");
}
代码示例来源:origin: facebook/facebook-android-sdk
final Date dataAccessExpirationTime
) {
Validate.notNullOrEmpty(accessToken, "accessToken");
Validate.notNullOrEmpty(applicationId, "applicationId");
Validate.notNullOrEmpty(userId, "userId");
代码示例来源:origin: facebook/facebook-android-sdk
@Nullable
final Uri linkUri) {
Validate.notNullOrEmpty(id, "id");
代码示例来源:origin: fr.avianey/facebook-android-api
public Logger(LoggingBehavior behavior, String tag) {
Validate.notNullOrEmpty(tag, "tag");
this.behavior = behavior;
this.tag = LOG_TAG_BASE + tag;
this.contents = new StringBuilder();
}
代码示例来源:origin: fr.avianey/facebook-android-api
TestSession(Activity activity, List<String> permissions, TokenCachingStrategy tokenCachingStrategy,
String sessionUniqueUserTag, Mode mode) {
super(activity, TestSession.testApplicationId, tokenCachingStrategy);
Validate.notNull(permissions, "permissions");
// Validate these as if they were arguments even though they are statics.
Validate.notNullOrEmpty(testApplicationId, "testApplicationId");
Validate.notNullOrEmpty(testApplicationSecret, "testApplicationSecret");
this.sessionUniqueUserTag = sessionUniqueUserTag;
this.mode = mode;
this.requestedPermissions = permissions;
}
代码示例来源:origin: fr.avianey/facebook-android-api
public static URI getProfilePictureUrl(
String userId,
int width,
int height)
throws URISyntaxException {
Validate.notNullOrEmpty(userId, "userId");
width = Math.max(width, UNSPECIFIED_DIMENSION);
height = Math.max(height, UNSPECIFIED_DIMENSION);
if (width == UNSPECIFIED_DIMENSION && height == UNSPECIFIED_DIMENSION) {
throw new IllegalArgumentException("Either width or height must be greater than 0");
}
Uri.Builder builder = new Uri.Builder().encodedPath(String.format(PROFILEPIC_URL_FORMAT, userId));
if (height != UNSPECIFIED_DIMENSION) {
builder.appendQueryParameter(HEIGHT_PARAM, String.valueOf(height));
}
if (width != UNSPECIFIED_DIMENSION) {
builder.appendQueryParameter(WIDTH_PARAM, String.valueOf(width));
}
builder.appendQueryParameter(MIGRATION_PARAM, MIGRATION_VALUE);
return new URI(builder.toString());
}
代码示例来源:origin: fr.avianey/facebook-android-api
protected BuilderBase(Context context, String applicationId, String action, Bundle parameters) {
if (applicationId == null) {
applicationId = Utility.getMetadataApplicationId(context);
}
Validate.notNullOrEmpty(applicationId, "applicationId");
this.applicationId = applicationId;
finishInit(context, action, parameters);
}
代码示例来源:origin: fr.avianey/facebook-android-api
/**
* Constructor.
*
* @param activity the Activity which is presenting the native Open Graph action publish dialog;
* must not be null
* @param action the Open Graph action to be published, which must contain a reference to at least one
* Open Graph object with the property name specified by setPreviewPropertyName; the action
* must have had its type specified via the {@link OpenGraphAction#setType(String)} method
* @param previewPropertyName the name of a property on the Open Graph action that contains the
* Open Graph object which will be displayed as a preview to the user
*/
public OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, String previewPropertyName) {
super(activity);
Validate.notNull(action, "action");
Validate.notNullOrEmpty(action.getType(), "action.getType()");
Validate.notNullOrEmpty(previewPropertyName, "previewPropertyName");
if (action.getProperty(previewPropertyName) == null) {
throw new IllegalArgumentException(
"A property named \"" + previewPropertyName + "\" was not found on the action. The name of " +
"the preview property must match the name of an action property.");
}
this.action = action;
this.actionType = action.getType();
this.previewPropertyName = previewPropertyName;
}
代码示例来源:origin: fr.avianey/facebook-android-api
Validate.notNullOrEmpty(actionType, "actionType");
Validate.notNullOrEmpty(previewPropertyName, "previewPropertyName");
if (action.getProperty(previewPropertyName) == null) {
throw new IllegalArgumentException(
内容来源于网络,如有侵权,请联系作者删除!