@ProviderType public final class TextUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getFirstNonEmpty(String... values)
Returns the first non-null and non-empty String from the parameter list of strings.
|
static <T> T |
getFirstNonNull(T... values)
Returns first non-null value from the parameter list
|
static <T> T |
getFirstProperty(org.apache.sling.api.resource.Resource resource,
Class<T> klass,
String... keys)
Returns first non-null value from the resource property.
|
static <T> T |
getFirstProperty(org.apache.sling.api.resource.ValueMap valueMap,
Class<T> klass,
String... keys)
Returns first non-null value from the resource property value map.
|
static boolean |
isRichText(String str)
Looks for <..> substrings in the parameter string.
|
public static <T> T getFirstNonNull(T... values)
Ex. TextUtil.getFirstNonNull(x.getLastModifiedDate(), x.getCreatedDate())
If getLastModifiedDate() returns null, and getCreatedDate() returns not-null, the value for getCreatedDate() is returned.
T - values - public static String getFirstNonEmpty(String... values)
Ex. TextUtil.getFirstNonEmpty(x.getPageTitle(), x.getNavigationTitle(), x.getTitle(), x.getName())
values - public static <T> T getFirstProperty(org.apache.sling.api.resource.Resource resource,
Class<T> klass,
String... keys)
T - resource - klass - keys - public static <T> T getFirstProperty(org.apache.sling.api.resource.ValueMap valueMap,
Class<T> klass,
String... keys)
Ex. TextUtil.getFirstProperty(Date.class, "jcr:lastModified", "jcr:created")
If getLastModifiedDate() returns null, and getCreatedDate() returns not-null, the value for getCreatedDate() is returned.
T - valueMap - of resource propertiesklass - data type to returnkeys - list of property names to evaluatepublic static boolean isRichText(String str)
str - Copyright © 2013–2020 Adobe. All rights reserved.