Class PropHelper
-
- All Implemented Interfaces:
public class PropHelper- Since:
2022-06-17
trydofor
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringDisabledValuepublic final static StringMaskingValue
-
Constructor Summary
Constructors Constructor Description PropHelper()
-
Method Summary
Modifier and Type Method Description static booleaninvalid(String str)invalid if null/blank/DisabledValue/MaskingValue static booleanvalid(String value)true if not invalid static LinkedHashSet<String>onlyValid(Collection<String> values)uniq and remove invalid static LinkedHashMap<String, String>onlyValid(Map<String, String> values)remain the entry if its value is valid static voidmergeToInvalid(@NotNull() Map<String, String> thiz, @Nullable() Map<String, String> that)if this.value is invalid, then use that. static StringstringResource(Resource resource)Use 'classpath:' format for ClassPathResource and getURL(). static StringprefixOptional(@NotNull() String url)make sure prefix `optional:` static StringremoveOptional(@NotNull() String url, String elz)remove prefix `optional:`, return elz if no prefix static StringremoveOptional(@NotNull() String url)remove prefix `optional:`, return the input url if no prefix static ResourceresourceString(String url)`optional:` prefix will return null if exception. static ResourceresourceString(String url, @NotNull() ResourceLoader resourceLoader)`optional:` prefix will return null if exception static StringcommaString(Array<Object> items)parse comma-delimited-list string, no strip item, no drop static StringcommaString(Collection<out Object> items)parse comma-delimited-list string, no strip item, no drop static StringcommaString(Array<Object> items, boolean strip, boolean drop)static StringcommaString(Collection<out Object> items, boolean strip, boolean drop)static StringdelimitedString(Array<Object> items, String delimiter, boolean strip, boolean drop)static StringdelimitedString(Collection<out Object> items, String delimiter, boolean strip, boolean drop)static Array<String>commaArray(String commaString)parse comma-delimited-list string, strip item, drop invalid static Array<String>commaArray(String commaString, boolean strip, boolean drop)parse comma-delimited-list string, whether to strip item, whether to drop invalid static List<String>commaList(String commaString)parse comma-delimited-list string, strip item, drop invalid static List<String>commaList(String commaString, boolean strip, boolean drop)parse comma-delimited-list string, whether to strip item, whether to drop invalid static List<String>delimitedList(String delimitedString, String delimiter, boolean strip, boolean drop)parse delimiter(comma if empty) delimited-list string, whether to strip item, whether to drop invalid -
-
Method Detail
-
onlyValid
@NotNull() static LinkedHashSet<String> onlyValid(Collection<String> values)
uniq and remove invalid
-
onlyValid
@NotNull() static LinkedHashMap<String, String> onlyValid(Map<String, String> values)
remain the entry if its value is valid
-
mergeToInvalid
static void mergeToInvalid(@NotNull() Map<String, String> thiz, @Nullable() Map<String, String> that)
if this.value is invalid, then use that.value by key
- Parameters:
thiz- this mapthat- that map
-
stringResource
@Contract(value = "!null->!null") static String stringResource(Resource resource)
Use 'classpath:' format for ClassPathResource and getURL().toExternalForm() for the rest
-
prefixOptional
@NotNull() static String prefixOptional(@NotNull() String url)
make sure prefix `optional:`
-
removeOptional
@Contract(value = "_,!null->!null") static String removeOptional(@NotNull() String url, String elz)
remove prefix `optional:`, return elz if no prefix
-
removeOptional
@NotNull() static String removeOptional(@NotNull() String url)
remove prefix `optional:`, return the input url if no prefix
-
resourceString
@Nullable() static Resource resourceString(String url)
`optional:` prefix will return null if exception. use ApplicationContext(if prepared) or DefaultResourceLoader as loader by default.
-
resourceString
@Nullable() static Resource resourceString(String url, @NotNull() ResourceLoader resourceLoader)
`optional:` prefix will return null if exception
-
commaString
@Contract(value = "!null -> !null") static String commaString(Array<Object> items)
parse comma-delimited-list string, no strip item, no drop
-
commaString
@Contract(value = "!null -> !null") static String commaString(Collection<out Object> items)
parse comma-delimited-list string, no strip item, no drop
-
commaString
@Contract(value = "!null,_,_ -> !null") static String commaString(Array<Object> items, boolean strip, boolean drop)
-
commaString
@Contract(value = "!null,_,_ -> !null") static String commaString(Collection<out Object> items, boolean strip, boolean drop)
-
delimitedString
@Contract(value = "!null,_,_,_ -> !null") static String delimitedString(Array<Object> items, String delimiter, boolean strip, boolean drop)
-
delimitedString
@Contract(value = "!null,_,_,_ -> !null") static String delimitedString(Collection<out Object> items, String delimiter, boolean strip, boolean drop)
-
commaArray
@NotNull() static Array<String> commaArray(String commaString)
parse comma-delimited-list string, strip item, drop invalid
-
commaArray
@NotNull() static Array<String> commaArray(String commaString, boolean strip, boolean drop)
parse comma-delimited-list string, whether to strip item, whether to drop invalid
-
commaList
@NotNull() static List<String> commaList(String commaString)
parse comma-delimited-list string, strip item, drop invalid
-
commaList
@NotNull() static List<String> commaList(String commaString, boolean strip, boolean drop)
parse comma-delimited-list string, whether to strip item, whether to drop invalid
-
delimitedList
@NotNull() static List<String> delimitedList(String delimitedString, String delimiter, boolean strip, boolean drop)
parse delimiter(comma if empty) delimited-list string, whether to strip item, whether to drop invalid
-
-
-
-