public class Optionals
extends java.lang.Object
| Constructor and Description |
|---|
Optionals() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Optional<java.lang.String> |
optional(java.util.List<java.util.Optional<java.lang.String>> segments,
java.lang.String separator)
Converts a list of optional string segments into a joined optional.
|
static java.util.Optional<java.lang.String> |
optional(org.gradle.api.Project project,
java.lang.String propertyName)
Wraps the project property identified by the parameter property name in
a string optional, iff the property is present and has a non-empty string
representation.
|
static java.util.Optional<java.lang.String> |
optional(java.lang.String value)
Converts the parameter string value into a string optional that is empty
iff the parameter is null, empty or white space.
|
public static java.util.Optional<java.lang.String> optional(java.lang.String value)
value - The string to convertpublic static java.util.Optional<java.lang.String> optional(org.gradle.api.Project project,
java.lang.String propertyName)
toString method is invoked on the
property value to convert to string.project - The project to locate the property value forpropertyName - The property name to look uppublic static java.util.Optional<java.lang.String> optional(java.util.List<java.util.Optional<java.lang.String>> segments,
java.lang.String separator)
The non-empty segments from the parameter list are joined using the parameter separator. The empty segments are omitted.
If every parameter segment is empty then the result is empty.
segments - The segments to joinseparator - The string separator to insert between the non-empty segments