com.stormpath.sdk.lang.Assert.hasText()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中com.stormpath.sdk.lang.Assert.hasText()方法的一些代码示例,展示了Assert.hasText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.hasText()方法的具体详情如下:
包路径:com.stormpath.sdk.lang.Assert
类名称:Assert
方法名:hasText

Assert.hasText介绍

[英]Assert that the given String has valid text content; that is, it must not be null and must contain at least one non-whitespace character.

Assert.hasText(name, "'name' must not be empty");

[中]断言给定字符串具有有效的文本内容;也就是说,它不能是null,并且必须至少包含一个非空白字符

Assert.hasText(name, "'name' must not be empty");

代码示例

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public MappingRuleBuilder setName(String name) {
  Assert.hasText(name, "name argument cannot be null or empty.");
  this.name = name;
  return this;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

public DefaultCanonicalUri(String absolutePath, QueryString query) {
  Assert.hasText(absolutePath, "absolutePath argument cannot be null or empty.");
  this.absolutePath = absolutePath;
  this.query = query;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

public Order(String propertyName, boolean ascending) {
  Assert.hasText(propertyName, "propertyName cannot be null or empty.");
  this.propertyName = propertyName;
  this.ascending = ascending;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public UsernamePasswordRequestBuilder setUsernameOrEmail(String usernameOrEmail) {
  Assert.hasText(usernameOrEmail, "usernameOrEmail cannot be null or empty.");
  this.usernameOrEmail = usernameOrEmail;
  return this;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

public StormpathAuthenticationEntryPoint(String loginUri, String produces, String meUri, String applicationName) {
  Assert.hasText(loginUri, "loginUri cannot be null or empty");
  Assert.hasText(produces, "produces cannot be null or empty");
  Assert.hasText(meUri, "meUri cannot be null or empty");
  this.loginUri = loginUri;
  this.meUri = meUri;
  this.applicationName = applicationName;
  this.supportedMediaTypes = MediaType.parseMediaTypes(produces);
  this.loginPageRedirector = new DefaultLoginPageRedirector(loginUri);
  this.om = new ObjectMapper();
}

代码示例来源:origin: stormpath/stormpath-sdk-java

public SingleNamedViewResolver(String viewName, View view, int order) {
  Assert.hasText(viewName, "viewName cannot be null or empty.");
  Assert.notNull(view, "view cannot be null.");
  this.viewName = viewName;
  this.view = view;
  this.order = order;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

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: stormpath/stormpath-sdk-java

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 <K, V> Cache<K, V> getCache(String name) {
    Assert.hasText(name, "name argument cannot be null or empty.");
    ConcurrentMap<K, V> hazelcastMap = hazelcastInstance.getMap(name);
    return new HazelcastCache<K, V>(hazelcastMap);
  }
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public String sign(String jsonPayload) {
  Assert.hasText(jsonPayload, "jsonPayload cannot be null or empty.");
  String base64UrlJsonPayload = Base64.encodeBase64URLSafeString(jsonPayload.getBytes(UTF_8));
  String signature = calculateSignature(BASE64_URL_JWT_SIGN_HEADER, base64UrlJsonPayload);
  return new StringBuilder(BASE64_URL_JWT_SIGN_HEADER)
    .append(JWT_TOKEN_SEPARATOR)
    .append(base64UrlJsonPayload)
    .append(JWT_TOKEN_SEPARATOR)
    .append(signature)
    .toString();
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public <T extends Resource> T instantiate(Class<T> clazz, Map<String, Object> properties, boolean hrefFragment) {
  if (hrefFragment) {
    Assert.hasText((String) properties.get("href"), "when hrefFragment is set to true the properties map must contain an href key.");
    String hrefValue = (String) properties.get("href");
    hrefValue = qualify(hrefValue);
    properties.put("href", hrefValue);
  }
  return this.instantiate(clazz, properties);
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public <T extends Resource & Saveable> void save(T resource) {
  String href = resource.getHref();
  Assert.hasText(href, HREF_REQD_MSG);
  save(href, resource, null, resource.getClass(), null, false);
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public ModeledEmailTemplate setLinkBaseUrl(String linkBaseUrl) {
  Assert.hasText(linkBaseUrl, "linkBaseUrl cannot be null or empty");
  Map<String, String> defaultModel = getDefaultModel(true);
  defaultModel.put(LINK_BASE_URL, linkBaseUrl);
  setProperty(DEFAULT_MODEL, defaultModel);
  return this;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

public SimpleExpression(String propertyName, Object value, Operator op) {
  Assert.hasText(propertyName, "propertyName must be a text value.");
  Assert.notNull(value, "value must not be null.");
  Assert.notNull(op, "operator must not be null");
  this.propertyName = propertyName;
  this.value = value;
  this.op = op;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public void init() {
  Assert.notNull(serverUriResolver, "serverUriResolver must be configured.");
  Assert.hasText(resultUri, "resultUri must be configured.");
  //not implemented yet
  //controller.setSamlOrganizationResolver(idSiteOrganizationResolver);
  super.init();
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
  public MappingRule build() {

    Assert.hasText(name, "name argument cannot be null or empty.");
    Assert.notEmpty(accountAttributes, "accountAttributes cannot be null or empty.");

    return new DefaultUserInfoMappingRule(name, accountAttributes);
  }
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public boolean hasNonce(String nonce) {
  Assert.hasText(nonce);
  Cache<String, Map<String, ?>> cache = cacheResolver.getCache(Nonce.class);
  Map<String, ?> values = cache.get(nonce);
  return values != null;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public void init() throws Exception {
  Assert.hasText(nextUri, "nextUri cannot be null or empty.");
  Assert.notNull(applicationResolver, "applicationResolver cannot be null.");
  Assert.notNull(authenticationResultSaver, "authenticationResultSaver cannot be null.");
  Assert.notNull(eventPublisher, "eventPublisher cannot be null.");
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public void init() throws Exception {
  Assert.hasText(this.uri, "uri cannot be null or empty.");
  Assert.notNull(this.accountModelFactory, "accountModelFactory cannot be null.");
  Assert.notNull(this.objectMapper, "objectMapper cannot be null.");
  Assert.notEmpty(this.produces, "produces cannot be null or empty");
  Assert.notNull(this.applicationResolver, "applicationResolver cannot be null.");
}

代码示例来源:origin: stormpath/stormpath-sdk-java

public DefaultOAuthBearerRequestAuthenticationResultBuilder(AccessToken accessToken) {
  Assert.notNull(accessToken, "accessToken cannot be null.");
  Assert.hasText(accessToken.getHref(), "accessToken's href cannot be null or empty.");
  Assert.notNull(accessToken.getApplication(), "accessToken's application cannot be null.");
  Assert.notNull(accessToken.getAccount(), "accessToken's account cannot be null.");
  Assert.notNull(accessToken.getTenant(), "accessToken's tenant cannot be null.");
  Assert.hasText(accessToken.getJwt(), "accessToken's JWT cannot be null or empty.");
  this.accessToken = accessToken;
}

相关文章