本文整理匯總了Java中com.facebook.internal.Validate.notNullOrEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java Validate.notNullOrEmpty方法的具體用法?Java Validate.notNullOrEmpty怎麽用?Java Validate.notNullOrEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.internal.Validate
的用法示例。
在下文中一共展示了Validate.notNullOrEmpty方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Profile
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* Contructor.
* @param id The id of the profile.
* @param firstName The first name of the profile. Can be null.
* @param middleName The middle name of the profile. Can be null.
* @param lastName The last name of the profile. Can be null.
* @param name The name of the profile. Can be null.
* @param linkUri The link for this profile. Can be null.
*/
public Profile(
final String id,
@Nullable
final String firstName,
@Nullable
final String middleName,
@Nullable
final String lastName,
@Nullable
final String name,
@Nullable
final Uri linkUri) {
Validate.notNullOrEmpty(id, "id");
this.id = id;
this.firstName = firstName;
this.middleName = middleName;
this.lastName = lastName;
this.name = name;
this.linkUri = linkUri;
}
示例2: OpenGraphDialogBuilderBase
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* 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 actionType the type of the Open Graph action to be published, which should be the namespace-qualified
* name of the action type (e.g., "myappnamespace:myactiontype"); this will override the type
* of the action passed in.
* @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
*/
@Deprecated
public OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, String actionType,
String previewPropertyName) {
super(activity);
Validate.notNull(action, "action");
Validate.notNullOrEmpty(actionType, "actionType");
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.");
}
String typeOnAction = action.getType();
if (!Utility.isNullOrEmpty(typeOnAction) && !typeOnAction.equals(actionType)) {
throw new IllegalArgumentException("'actionType' must match the type of 'action' if it is specified. " +
"Consider using OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, " +
"String previewPropertyName) instead.");
}
this.action = action;
this.actionType = actionType;
this.previewPropertyName = previewPropertyName;
}
示例3: AccessToken
import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
* Creates a new AccessToken using the supplied information from a previously-obtained access
* token (for instance, from an already-cached access token obtained prior to integration with
* the Facebook SDK). Note that the caller is asserting that all parameters provided are correct
* with respect to the access token string; no validation is done to verify they are correct.
*
* @param accessToken the access token string obtained from Facebook
* @param applicationId the ID of the Facebook Application associated with this access
* token
* @param userId the id of the user
* @param permissions the permissions that were requested when the token was obtained
* (or when it was last reauthorized); may be null if permission set
* is unknown
* @param declinedPermissions the permissions that were declined when the token was obtained;
* may be null if permission set is unknown
* @param accessTokenSource an enum indicating how the token was originally obtained (in most
* cases, this will be either AccessTokenSource.FACEBOOK_APPLICATION
* or AccessTokenSource.WEB_VIEW); if null, FACEBOOK_APPLICATION is
* assumed.
* @param expirationTime the expiration date associated with the token; if null, an
* infinite expiration time is assumed (but will become correct when
* the token is refreshed)
* @param lastRefreshTime the last time the token was refreshed (or when it was first
* obtained); if null, the current time is used.
*/
public AccessToken(
final String accessToken,
final String applicationId,
final String userId,
@Nullable
final Collection<String> permissions,
@Nullable
final Collection<String> declinedPermissions,
@Nullable
final AccessTokenSource accessTokenSource,
@Nullable
final Date expirationTime,
@Nullable
final Date lastRefreshTime
) {
Validate.notNullOrEmpty(accessToken, "accessToken");
Validate.notNullOrEmpty(applicationId, "applicationId");
Validate.notNullOrEmpty(userId, "userId");
this.expires = expirationTime != null ? expirationTime : DEFAULT_EXPIRATION_TIME;
this.permissions = Collections.unmodifiableSet(
permissions != null ? new HashSet<String>(permissions) : new HashSet<String>());
this.declinedPermissions = Collections.unmodifiableSet(
declinedPermissions != null
? new HashSet<String>(declinedPermissions)
: new HashSet<String>());
this.token = accessToken;
this.source = accessTokenSource != null ? accessTokenSource : DEFAULT_ACCESS_TOKEN_SOURCE;
this.lastRefresh = lastRefreshTime != null ? lastRefreshTime : DEFAULT_LAST_REFRESH_TIME;
this.applicationId = applicationId;
this.userId = userId;
}
示例4: TestSession
import com.facebook.internal.Validate; //導入方法依賴的package包/類
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;
}
示例5: BuilderBase
import com.facebook.internal.Validate; //導入方法依賴的package包/類
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);
}