public interface StringTools
Tools for working with strings.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public String |
hashUri(URI uri)Creates a SHA-256 has of a URI. |
|
public String |
loadTextFromResource(String resourcePath)Loads text from a resource file. |
|
public String |
packageNameFromUri(URI uri)Get final package or directory name from a URI |
|
public java.util.regex.Pattern |
patternize(Object stringy)Converts most things to a pattern. |
|
public java.util.List<java.util.regex.Pattern> |
patternize(java.util.Collection<?> stringyThings)Converts a collection of most things to a list of regex patterns. |
|
public java.util.List<java.util.regex.Pattern> |
patternizeDropNull(java.util.Collection<?> stringyThings)Like patternize, but drops any nulls, or empty instances of Provider and java.util.Optional. |
|
public java.util.regex.Pattern |
patternizeOrNull(Object stringy)Like patternize, but returns null rather than throwing an exception, when item is null,
an empty {
|
|
public Provider<java.util.regex.Pattern> |
providePattern(Object stringy)Like patternize, but does not immediately evaluate the passed parameter. |
|
public Provider<java.util.regex.Pattern> |
providePatternOrNull(Object stringy)Like patternizeOrNull(Object), but does not evaluate the passed parameter immediately. |
|
public Provider<String> |
provideString(Object stringy)Like stringize, but does not immediately evaluate the passed parameter. |
|
public Provider<String> |
provideStringOrNull(Object stringy)Like stringizeOrNull(Object), but does not evaluate the passed parameter immediately. |
|
public Provider<String> |
provideTextFromResource(String resourcePath)Lazy-loads text from a resource file. |
|
public Provider<URI> |
provideUri(Object uriThingy)Similar to urize(Object), but does not evaluate the parameter immediately, only when the provider is resolved. |
|
public Provider<java.util.Map<String, String>> |
provideValues(java.util.Map<String, ?> props)Similar to stringizeValues, but does not evaluate the parameter immediately, only when the provider is resolved. |
|
public Provider<java.util.Map<String, String>> |
provideValues(Provider<java.util.Map<String, Object>> props)Similar to stringizeValues, but does not evaluate the parameter immediately, only when the provider is resolved. |
|
public Provider<java.util.Map<String, String>> |
provideValuesDropNull(java.util.Map<String, ?> props)Similar to stringizeValuesDropNull(Map), but does not evaluate the parameter immediately, only when the provider is resolved. |
|
public Provider<java.util.Map<String, String>> |
provideValuesDropNull(Provider<java.util.Map<String, Object>> props)Similar to stringizeValuesDropNull(Map), but does not evaluate the parameter immediately, only when the provider is resolved. |
|
public URI |
safeUri(URI uri)Create a URI where the user/password is masked out. |
|
public String |
stringize(Object stringy)Converts most things to a string. |
|
public java.util.List<String> |
stringize(java.util.Collection<?> stringyThings)Converts a collection of most things to a list of strings. |
|
public java.util.List<String> |
stringizeDropNull(java.util.Collection<?> stringyThings)Like stringize, but drops any nulls, or empty instances of Provider and java.util.Optional. |
|
public String |
stringizeOrNull(Object stringy)Like stringize, but returns null rather than throwing an exception, when item is null,
an empty {
|
|
public java.util.Map<String, String> |
stringizeValues(java.util.Map<String, ?> props)Evaluates a map of objects to a map of strings. |
|
public java.util.Map<String, String> |
stringizeValuesDropNull(java.util.Map<String, ?> props)Like stringizeValues(Map), but drops the key, if the corresponding value is null or an empty Provider or java.util.Optional. |
|
public void |
updateStringProperty(Property<String> provider, Object stringy)Updates a Property<String>. |
|
public URI |
urize(Object uriThingy)Attempts to convert object to a URI. |
Creates a SHA-256 has of a URI.
uri - URI to hashLoads text from a resource file.
resourcePath - Resource path.Get final package or directory name from a URI
uri - URI to processConverts most things to a pattern. Closures are evaluated as well.
Converts collections of the following recursively until it gets to a pattern:
CharSequence including String and GString.
stringy - An object that can be converted to a pattern or a closure that
can be evaluated to something that can be converted to a pattern.Converts a collection of most things to a list of regex patterns. Closures are evaluated as well.
stringyThings - Iterable list of objects that can be converted to patterns,
including closure that can be evaluated
into objects that can be converted to patterns.Like patternize, but drops any nulls, or empty instances of Provider and java.util.Optional.
stringyThings - Iterable list of objects that can be converted to patterns,
including closure that can be evaluated
into objects that can be converted to patterns. Like patternize, but returns null rather than throwing an exception, when item is null,
an empty {
stringy - An object that can be converted to a pattern or a closure that
can be evaluated to something that can be converted to a pattern.nullLike patternize, but does not immediately evaluate the passed parameter. The latter is only done when the provider is resolved.
stringy - An object that can be converted to a pattern or a closure that
can be evaluated to something that can be converted to a pattern.Like patternizeOrNull(Object), but does not evaluate the passed parameter immediately.
stringy - An object that can be converted to a pattern or a closure that
can be evaluated to something that can be converted to a pattern.Like stringize, but does not immediately evaluate the passed parameter. The latter is only done when the provider is resolved.
stringy - An object that can be converted to a string or a closure that
can be evaluated to something that can be converted to a string.Like stringizeOrNull(Object), but does not evaluate the passed parameter immediately.
stringy - Anything convertible to a string.Lazy-loads text from a resource file.
resourcePath - Resource path.Similar to urize(Object), but does not evaluate the parameter immediately, only when the provider is resolved.
uriThingy - Anything that could be converted to a URISimilar to stringizeValues, but does not evaluate the parameter immediately, only when the provider is resolved.
props - A map that is keyed on strings, but for which the values can be converted to strings
using stringize(Object).Similar to stringizeValues, but does not evaluate the parameter immediately, only when the provider is resolved.
props - A provider to a map that is keyed on strings, but for which the values can be converted to strings
using stringize(Object).Similar to stringizeValuesDropNull(Map), but does not evaluate the parameter immediately, only when the provider is resolved.
props - A map that is keyed on strings, but for which the values can be converted to strings
using stringize(Object).Similar to stringizeValuesDropNull(Map), but does not evaluate the parameter immediately, only when the provider is resolved.
props - A provider to a map that is keyed on strings, but for which the values can be converted to strings
using stringize(Object).Create a URI where the user/password is masked out.
uri - Original URIConverts most things to a string. Closures are evaluated as well.
Converts collections of the following recursively until it gets to a string:
CharSequence including String and GString.
stringy - An object that can be converted to a string or a closure that
can be evaluated to something that can be converted to a string.Converts a collection of most things to a list of strings. Closures are evaluated as well.
stringyThings - Iterable list of objects that can be converted to strings, including closure that can be evaluated
into objects that can be converted to strings.Like stringize, but drops any nulls, or empty instances of Provider and java.util.Optional.
Like stringize, but returns null rather than throwing an exception, when item is null,
an empty {
nullEvaluates a map of objects to a map of strings.
Anything value that can be evaluated by stringize is evaluated
props - Map that will be evaluatedMap<String,String>Like stringizeValues(Map), but drops the key, if the corresponding value is null or an empty Provider or java.util.Optional.
props - Map that wil be evaluatednull. Updates a Property<String>.
THis provides a more powerful way than Property.set.
provider - String propertystringy - Objexct that is a string or can be converted to a string.Attempts to convert object to a URI.
Converts collections of the following recursively until it gets to a file:
CharSequence including String and GString.
uriThingy - Anything that could be converted to a URI