@Override public FilterBuilder setName(String name) { this.name = Strings.clean(name); return this; }
/** * Convenience method to return a Collection as a delimited (e.g. CSV) * String. E.g. useful for <code>toString()</code> implementations. * @param coll the Collection to display * @param delim the delimiter to use (probably a ",") * @return the delimited String */ public static String collectionToDelimitedString(Collection<?> coll, String delim) { return collectionToDelimitedString(coll, delim, "", ""); }
@Override public List<String> getValues(String key, List<String> defaultValues) { String value = getValue(key); if (Strings.hasText(value)) { return new ArrayList<>(Strings.commaDelimitedListToSet(value)); } return defaultValues; } }
public DefaultOktaSigningKeyResolver(DataStore dataStore, String authorizationServerId, boolean allowApiSecret) { this.dataStore = dataStore; this.allowApiSecret = allowApiSecret; if (Strings.hasText(authorizationServerId)) { // as that Resource is NOT cached. this.keysUrl = "/oauth2/" + authorizationServerId + "/v1/keys"; } }
private void buildFlattenedMap(Map<String, String> result, Map<String, Object> source, String path) { for (Map.Entry<String, Object> entry : source.entrySet()) { String key = entry.getKey(); if (Strings.hasText(path)) { if (key.startsWith("[")) { key = path + key; result.put(key, Strings.collectionToCommaDelimitedString(collection));
@Override public byte[] resolveSigningKeyBytes(JwsHeader header, Claims claims) { String keyId = header.getKeyId(); if (Strings.hasText(keyId) && !clientApiKey.getId().equals(keyId)) { String url = dataStore.getBaseUrl() + "/apiKeys/" + keyId; ApiKey apiKey = dataStore.getResource(url, ApiKey.class); return Strings.getBytesUtf8(apiKey.getSecret()); } return Strings.getBytesUtf8(clientApiKey.getSecret()); } }).parseClaimsJws(token);
/** * Check that the given String is neither <code>null</code> nor of length 0. * Note: Will return <code>true</code> for a String that purely consists of whitespace. * @param str the String to check (may be <code>null</code>) * @return <code>true</code> if the String is not null and has length * @see #hasLength(CharSequence) */ public static boolean hasLength(String str) { return hasLength((CharSequence) str); }
public static String[] split(String line, char delimiter, char quoteChar) { return split(line, delimiter, quoteChar, quoteChar); }
public UnresolvedMediaTypeException(List<MediaType> acceptedMediaTypes, List<MediaType> producesMediaTypes, String message) { super(MessageFormat.format("No MediaType could be resolved for this request ({0})" + " and the configured producesMediaTypes settings ({1}). {2}", Strings.collectionToCommaDelimitedString(acceptedMediaTypes), Strings.collectionToCommaDelimitedString(producesMediaTypes), message)); } }
public static QueryString create(String query) { if (!Strings.hasLength(query)) { return null; } QueryString queryString = new QueryString(); // only returns null if string is null String[] tokens = Strings.tokenizeToStringArray(query, "&", false, false); for( String token : tokens) { applyKeyValuePair(queryString, token); } return queryString; }
return null; String pathToUse = replace(path, WINDOWS_FOLDER_SEPARATOR, FOLDER_SEPARATOR); String[] pathArray = delimitedListToStringArray(pathToUse, FOLDER_SEPARATOR); List<String> pathElements = new LinkedList<String>(); int tops = 0; return prefix + collectionToDelimitedString(pathElements, FOLDER_SEPARATOR);
public Collection<String> stormpathFilterServletNames() { return Strings.commaDelimitedListToSet(stormpathFilterServletNames); }
private static void append(StringBuilder sb, String value) { if (Strings.hasText(value)) { sb.append(value); } }
@Override public List<String> getValues(String key, List<String> defaultValues) { String value = getValue(key); if (Strings.hasText(value)) { return new ArrayList<>(Strings.commaDelimitedListToSet(value)); } return defaultValues; } }
private void buildFlattenedMap(Map<String, String> result, Map<String, Object> source, String path) { for (Map.Entry<String, Object> entry : source.entrySet()) { String key = entry.getKey(); if (Strings.hasText(path)) { if (key.startsWith("[")) { key = path + key; result.put(key, Strings.collectionToCommaDelimitedString(collection));
/** * Assert that the given String is not empty; that is, * it must not be <code>null</code> and not the empty String. * <pre class="code">Assert.hasLength(name, "Name must not be empty");</pre> * @param text the String to check * @param message the exception message to use if the assertion fails * @see Strings#hasLength */ public static void hasLength(String text, String message) { if (!Strings.hasLength(text)) { throw new IllegalArgumentException(message); } }
public static String[] split(String line, char delimiter, char beginQuoteChar, char endQuoteChar) { return split(line, delimiter, beginQuoteChar, endQuoteChar, false, true); }
public UnresolvedMediaTypeException(List<MediaType> acceptedMediaTypes, List<MediaType> producesMediaTypes, String message) { super(MessageFormat.format("No MediaType could be resolved for this request ({0})" + " and the configured producesMediaTypes settings ({1}). {2}", Strings.collectionToCommaDelimitedString(acceptedMediaTypes), Strings.collectionToCommaDelimitedString(producesMediaTypes), message)); } }
public static QueryString create(String query) { if (!Strings.hasLength(query)) { return null; } QueryString queryString = new QueryString(); // only returns null if string is null String[] tokens = Strings.tokenizeToStringArray(query, "&", false, false); for( String token : tokens) { applyKeyValuePair(queryString, token); } return queryString; }