本文整理了Java中com.stormpath.sdk.lang.Assert.notEmpty()
方法的一些代码示例,展示了Assert.notEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.notEmpty()
方法的具体详情如下:
包路径:com.stormpath.sdk.lang.Assert
类名称:Assert
方法名:notEmpty
[英]Assert that a collection has elements; that is, it must not be null
and must have at least one element.
Assert.notEmpty(collection, "Collection must have elements");
[中]断言集合具有元素;也就是说,它不能是null
,并且必须至少有一个元素
Assert.notEmpty(collection, "Collection must have elements");
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
@Override
public MappingRuleBuilder setAccountAttributes(Set<String> accountAttributes) {
Assert.notEmpty(accountAttributes, "accountAttributes cannot be null or empty.");
this.accountAttributes = accountAttributes;
return this;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
/**
* Assert that a Map has entries; that is, it must not be <code>null</code>
* and must have at least one entry.
* <pre class="code">Assert.notEmpty(map);</pre>
* @param map the map to check
* @throws IllegalArgumentException if the map is <code>null</code> or has no entries
*/
public static void notEmpty(Map map) {
notEmpty(map, "[Assertion failed] - this map must not be empty; it must contain at least one entry");
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public MappingRuleBuilder setAccountAttributes(Set<String> accountAttributes) {
Assert.notEmpty(accountAttributes, "accountAttributes cannot be null or empty.");
this.accountAttributes = accountAttributes;
return this;
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
public AttributeStatementMappingRulesBuilder setAttributeStatementMappingRules(Set<AttributeStatementMappingRule> attributeStatementMappingRules){
Assert.notEmpty(attributeStatementMappingRules, "attributeStatementMappingRules argument cannot be null or empty.");
this.attributeStatementMappingRules = attributeStatementMappingRules;
return this;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public AuthenticationResultSaver(List<Saver<AuthenticationResult>> savers) {
Assert.notEmpty(savers, "At least one Saver<AuthenticationResult> must be specified.");
this.savers = Collections.unmodifiableList(savers);
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public DefaultAttributeStatementMappingRule(String name, String nameFormat, Set<String> accountAttributes) {
Assert.hasText(name, "name argument cannot be null or empty.");
Assert.notEmpty(accountAttributes, "accountAttributes cannot be null or empty.");
this.name = name;
this.accountAttributes = Collections.unmodifiableSet(accountAttributes);
this.nameFormat = nameFormat != null ? nameFormat : null;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
protected void onInit() throws Exception {
super.onInit();
Assert.notNull(this.allowedOrigins, "allowedOrigins cannot be null.");
Assert.notEmpty(this.allowedHttpMethods, "allowedHttpMethods cannot be empty.");
Assert.notEmpty(this.allowedHttpHeaders, "allowedHttpHeaders cannot be empty.");
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
@Override
public MappingRuleBuilder setAccountAttributes(String... accountAttributes) {
Assert.notEmpty(accountAttributes, "accountAttributes cannot be null or empty.");
Set<String> names = new LinkedHashSet<String>(accountAttributes.length);
for (String attrName : accountAttributes) {
Assert.hasText("individual accountAttributes cannot be null or empty.");
names.add(attrName);
}
this.accountAttributes = names;
return this;
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
public DefaultUserInfoMappingRule(String name, Set<String> accountAttributes) {
Assert.hasText(name, "name argument cannot be null or empty.");
Assert.notEmpty(accountAttributes, "accountAttributes cannot be null or empty.");
this.name = name;
this.accountAttributes = Collections.unmodifiableSet(accountAttributes);
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-servlet
@Override
protected void onInit() throws Exception {
super.onInit();
Assert.notNull(this.allowedOrigins, "allowedOrigins cannot be null.");
Assert.notEmpty(this.allowedHttpMethods, "allowedHttpMethods cannot be empty.");
Assert.notEmpty(this.allowedHttpHeaders, "allowedHttpHeaders cannot be empty.");
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public AuthorizationHeaderAuthenticator(List<HttpAuthenticationScheme> schemes, boolean sendChallengeOnFailure,
Publisher<RequestEvent> eventPublisher) {
Assert.notEmpty(schemes, "AuthenticationScheme list cannot be null or empty.");
Assert.notNull(eventPublisher, "Event Publisher cannot be null.");
this.sendChallengeOnFailure = sendChallengeOnFailure;
this.eventPublisher = eventPublisher;
this.schemes = new LinkedHashMap<String, HttpAuthenticationScheme>(schemes.size());
for (HttpAuthenticationScheme scheme : schemes) {
this.schemes.put(scheme.getName().toLowerCase(), scheme);
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-servlet
public AuthorizationHeaderAuthenticator(List<HttpAuthenticationScheme> schemes, boolean sendChallengeOnFailure,
Publisher<RequestEvent> eventPublisher) {
Assert.notEmpty(schemes, "AuthenticationScheme list cannot be null or empty.");
Assert.notNull(eventPublisher, "Event Publisher cannot be null.");
this.sendChallengeOnFailure = sendChallengeOnFailure;
this.eventPublisher = eventPublisher;
this.schemes = new LinkedHashMap<String, HttpAuthenticationScheme>(schemes.size());
for (HttpAuthenticationScheme scheme : schemes) {
this.schemes.put(scheme.getName().toLowerCase(), scheme);
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
public DefaultUserInfoMappingRule(String name, String... accountAttributes) {
Assert.hasText(name, "name argument cannot be null or empty.");
Assert.notNull(accountAttributes, "accountAttributes cannot be null or empty.");
Set<String> names = new LinkedHashSet<String>(accountAttributes.length);
for (String attrName : accountAttributes) {
Assert.hasText("individual accountAttributes cannot be null or empty.");
names.add(attrName);
}
this.name = name;
Assert.notEmpty(names, "accountAttributes cannot be null or empty.");
this.accountAttributes = Collections.unmodifiableSet(names);
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
public UserInfoMappingRules build() {
Assert.notEmpty(userInfoMappingRules, "userInfoMappingRules argument cannot be null or empty.");
UserInfoMappingRules rules = new DefaultUserInfoMappingRules(null);
rules.setItems(userInfoMappingRules);
return rules;
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
public AttributeStatementMappingRules build(){
Assert.notEmpty(attributeStatementMappingRules, "attributeStatementMappingRules argument cannot be null or empty.");
AttributeStatementMappingRules rules = new DefaultAttributeStatementMappingRules(null);
rules.setItems(attributeStatementMappingRules);
return rules;
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
public MappingRule build(){
Assert.hasText(name, "name argument cannot be null or empty.");
Assert.notEmpty(accountAttributes, "accountAttributes cannot be null or empty.");
return new DefaultAttributeStatementMappingRule(name, nameFormat, accountAttributes);
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-oauth
public JwtOAuthIssuer(JwtSigner jwtSigner, Map<String, Object> payload) {
Assert.notNull(jwtSigner, "jwtSigner cannot be null.");
Assert.notEmpty(payload, "payload cannot be null or empty.");
this.jwtSigner = jwtSigner;
this.payload = payload;
this.mapMarshaller = new JacksonMapMarshaller();
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public JwtOAuthIssuer(JwtSigner jwtSigner, Map<String, Object> payload) {
Assert.notNull(jwtSigner, "jwtSigner cannot be null.");
Assert.notEmpty(payload, "payload cannot be null or empty.");
this.jwtSigner = jwtSigner;
this.payload = payload;
this.mapMarshaller = new JacksonMapMarshaller();
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public SpringView(Collection<ViewResolver> viewResolvers, LocaleResolver localeResolver, HandlerInterceptor templateHandlerInterceptor) {
Assert.notEmpty(viewResolvers, "viewResolvers cannot be null or empty.");
Assert.notNull(localeResolver, "localeResolver cannot be null.");
Assert.notNull(templateHandlerInterceptor, "templateHandlerInterceptor cannot be null.");
this.handlerInterceptor = templateHandlerInterceptor;
List<ViewResolver> l = new ArrayList<>(viewResolvers);
//it is important to keep view resolvers sorted based on priority. Spring's DispatcherServlet does this
//so we need to do the same:
AnnotationAwareOrderComparator.sort(l);
this.viewResolvers = l;
this.localeResolver = localeResolver;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
@Override
protected void onInit() throws Exception {
Assert.notNull(controller, "Controller instance must be configured.");
Assert.notEmpty(producedMediaTypes, "producedMediaTypes property cannot be null or empty.");
if (this.viewResolver == null) {
InternalResourceViewResolver irvr = new InternalResourceViewResolver();
irvr.setPrefix(getPrefix());
irvr.setSuffix(getSuffix());
this.viewResolver = new DefaultViewResolver(irvr, new JacksonView(), producedMediaTypes);
}
}
内容来源于网络,如有侵权,请联系作者删除!