本文整理了Java中com.stormpath.sdk.lang.Assert.state()
方法的一些代码示例,展示了Assert.state()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.state()
方法的具体详情如下:
包路径:com.stormpath.sdk.lang.Assert
类名称:Assert
方法名:state
[英]Assert a boolean expression, throwing IllegalStateExceptionif the test result is false
.
Call #isTrue(boolean) if you wish to throw IllegalArgumentException on an assertion failure.
Assert.state(id == null);
[中]断言一个布尔表达式,如果测试结果为false
,则抛出IllegalStateException。
如果希望在断言失败时抛出IllegalArgumentException,请调用#isTrue(布尔值)。
Assert.state(id == null);
代码示例来源:origin: stormpath/stormpath-sdk-java
private int ensureOrderIndex() {
int i = this.currentOrderIndex;
Assert.state(i >= 0, "There is no current orderBy clause to declare as ascending or descending!");
return i;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
/**
* Assert a boolean expression, throwing {@link IllegalStateException}
* if the test result is <code>false</code>.
* <p>Call {@link #isTrue(boolean)} if you wish to
* throw {@link IllegalArgumentException} on an assertion failure.
* <pre class="code">Assert.state(id == null);</pre>
* @param expression a boolean expression
* @throws IllegalStateException if the supplied expression is <code>false</code>
*/
public static void state(boolean expression) {
state(expression, "[Assertion failed] - this state invariant must be true");
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
@Override
public OAuthClientCredentialsGrantRequestAuthentication build() {
Assert.state(this.apiKeyId != null, "apiKeyId has not been set. It is a required attribute.");
Assert.state(this.apiKeySecret != null, "apiKeySecret has not been set. It is a required attribute.");
DefaultOAuthClientCredentialsGrantRequestAuthentication request = new DefaultOAuthClientCredentialsGrantRequestAuthentication(apiKeyId, apiKeySecret);
return request;
}
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public OAuthClientCredentialsGrantRequestAuthentication build() {
Assert.state(this.apiKeyId != null, "apiKeyId has not been set. It is a required attribute.");
Assert.state(this.apiKeySecret != null, "apiKeySecret has not been set. It is a required attribute.");
DefaultOAuthClientCredentialsGrantRequestAuthentication request = new DefaultOAuthClientCredentialsGrantRequestAuthentication(apiKeyId, apiKeySecret);
return request;
}
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public OAuthPasswordGrantRequestAuthentication build() {
Assert.state(this.login != null, "login has not been set. It is a required attribute.");
Assert.state(this.password != null, "password has not been set. It is a required attribute.");
DefaultOAuthPasswordGrantRequestAuthentication request = new DefaultOAuthPasswordGrantRequestAuthentication(login, password);
if (this.accountStore != null) {
request.setAccountStore(this.accountStore);
}
return request;
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
@Override
public OAuthPasswordGrantRequestAuthentication build() {
Assert.state(this.login != null, "login has not been set. It is a required attribute.");
Assert.state(this.password != null, "password has not been set. It is a required attribute.");
DefaultOAuthPasswordGrantRequestAuthentication request = new DefaultOAuthPasswordGrantRequestAuthentication(login, password);
if (this.accountStore != null) {
request.setAccountStore(this.accountStore);
}
return request;
}
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
@SuppressWarnings("unchecked")
public int compare(T o1, T o2) {
Assert.state(this.comparators.size() > 0,
"No sort definitions have been added to this CompoundComparator to compare");
for (InvertibleComparator comparator : this.comparators) {
int result = comparator.compare(o1, o2);
if (result != 0) {
return result;
}
}
return 0;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public IdSiteAuthenticationRequest build() {
Assert.state(this.token != null, "token has not been set. It is a required attribute.");
IdSiteAuthenticationRequest request = new DefaultIdSiteAuthenticationRequest(token);
return request;
}
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public CreateProviderRequest build() {
final String providerId = getConcreteProviderId();
Assert.state(Strings.hasText(providerId), "The providerId property is missing.");
Assert.state(Strings.hasText(encodedX509SigningCert), "The encodedX509SigningCert property is missing.");
Assert.state(Strings.hasText(requestSignatureAlgorithm), "The requestSignatureAlgorithm property is missing.");
Assert.state(Strings.hasText(ssoLoginUrl), "The ssoLoginUrl property is missing.");
Assert.state(Strings.hasText(ssoLogoutUrl), "The ssoLogoutUrl property is missing.");
Map<String, Object> properties = new LinkedHashMap<String, Object>();
properties.put("providerId", providerId);
return doBuild(Collections.unmodifiableMap(properties));
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
public CreateProviderRequest build() {
final String providerId = getConcreteProviderId();
Assert.state(Strings.hasText(providerId), "The providerId property is missing.");
Assert.state(Strings.hasText(encodedX509SigningCert), "The encodedX509SigningCert property is missing.");
Assert.state(Strings.hasText(requestSignatureAlgorithm), "The requestSignatureAlgorithm property is missing.");
Assert.state(Strings.hasText(ssoLoginUrl), "The ssoLoginUrl property is missing.");
Assert.state(Strings.hasText(ssoLogoutUrl), "The ssoLogoutUrl property is missing.");
Map<String, Object> properties = new LinkedHashMap<String, Object>();
properties.put("providerId", providerId);
return doBuild(Collections.unmodifiableMap(properties));
}
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public CreateProviderRequest build() {
Assert.state(Strings.hasText(this.clientId), "clientId is a required property. It must be provided before building.");
Assert.state(Strings.hasText(this.clientSecret), "clientSecret is a required property. It must be provided before building.");
final String providerId = getConcreteProviderId();
Assert.state(Strings.hasText(providerId), "The providerId property is missing.");
Map<String, Object> properties = new LinkedHashMap<>();
properties.put("providerId", providerId);
return doBuild(Collections.unmodifiableMap(properties));
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public ProviderAccountRequest build() {
final String providerId = getConcreteProviderId();
Assert.state(Strings.hasText(providerId), "The providerId property is missing.");
Map<String, Object> properties = new LinkedHashMap<>();
properties.put("providerId", providerId);
return doBuild(Collections.unmodifiableMap(properties));
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
protected ProviderAccountRequest doBuild(Map<String, Object> map) {
Assert.state(hasText(super.accessToken) && hasText(this.accessTokenSecret), "Both accessToken and accessTokenSecret must be provided before building.");
Map<String, Object> properties = new HashMap<>(map);
properties.put("accessToken", accessToken);
properties.put("accessTokenSecret", accessTokenSecret);
ProviderData providerData = newProviderData(properties);
return new DefaultProviderAccountRequest(providerData, redirectUri);
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
@Override
protected ProviderAccountRequest doBuild(Map<String, Object> map) {
Assert.state(hasText(super.accessToken) && hasText(this.accessTokenSecret), "Both accessToken and accessTokenSecret must be provided before building.");
Map<String, Object> properties = new HashMap<>(map);
properties.put("accessToken", accessToken);
properties.put("accessTokenSecret", accessTokenSecret);
ProviderData providerData = newProviderData(properties);
return new DefaultProviderAccountRequest(providerData, redirectUri);
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
@Override
protected ProviderAccountRequest doBuild(Map<String, Object> map) {
Assert.state(hasText(this.code) ^ hasText(super.accessToken), "Either accessToken or code must be provided before building.");
Map<String, Object> properties = new HashMap<>(map);
if (hasText(accessToken)) {
properties.put("accessToken", accessToken);
} else {
properties.put("code", code);
}
ProviderData providerData = newProviderData(properties);
return new DefaultProviderAccountRequest(providerData, redirectUri);
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
protected ProviderAccountRequest doBuild(Map<String, Object> map) {
Assert.state(hasText(this.code) ^ hasText(super.accessToken), "Either accessToken or code must be provided before building.");
Map<String, Object> properties = new HashMap<>(map);
if (hasText(accessToken)) {
properties.put("accessToken", accessToken);
} else {
properties.put("code", code);
}
ProviderData providerData = newProviderData(properties);
return new DefaultProviderAccountRequest(providerData, redirectUri);
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public VerificationEmailRequest build() {
Assert.state(Strings.hasText(this.login), "login is a required property. It must be provided before building.");
DefaultVerificationEmailRequest verificationEmailRequest = new DefaultVerificationEmailRequest(null);
verificationEmailRequest.setLogin(login);
if (accountStore != null) {
verificationEmailRequest.setAccountStore(accountStore);
}
return verificationEmailRequest;
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
@Override
public AuthenticationRequest build() {
Assert.state(this.usernameOrEmail != null, "usernameOrEmail has not been set. It is a required attribute.");
DefaultUsernamePasswordRequest request = new DefaultUsernamePasswordRequest(usernameOrEmail, password);
if (this.host != null) { request.setHost(this.host); }
if (this.accountStore != null) { request.setAccountStore(this.accountStore); }
if (this.options != null) { request.setResponseOptions(this.options); }
if (this.organizationNameKey != null) { request.setOrganizationNameKey(this.organizationNameKey); }
return request;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public AuthenticationRequest build() {
Assert.state(this.usernameOrEmail != null, "usernameOrEmail has not been set. It is a required attribute.");
DefaultUsernamePasswordRequest request = new DefaultUsernamePasswordRequest(usernameOrEmail, password);
if (this.host != null) { request.setHost(this.host); }
if (this.accountStore != null) { request.setAccountStore(this.accountStore); }
if (this.options != null) { request.setResponseOptions(this.options); }
if (this.organizationNameKey != null) { request.setOrganizationNameKey(this.organizationNameKey); }
return request;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
protected CreateProviderRequest doBuild(Map<String, Object> map) {
Assert.state(Strings.hasText(this.redirectUri), "redirectUri is a required property. It must be provided before building.");
DefaultGoogleProvider provider = new DefaultGoogleProvider(null, map);
provider.setClientId(super.clientId);
provider.setClientSecret(super.clientSecret);
provider.setRedirectUri(this.redirectUri);
if (super.userInfoMappingRules != null) {
provider.setUserInfoMappingRules(super.userInfoMappingRules);
}
return new DefaultCreateProviderRequest(provider);
}
内容来源于网络,如有侵权,请联系作者删除!