public final class DiggEnums extends Object
enums.| Modifier and Type | Method and Description |
|---|---|
static <E extends Enum<E>> |
fromCommaSeparated(String enumsString,
Function<String,String> toEnumName,
Class<E> enumType)
Resolve
enum constants from a string of comma separated identifiers. |
static <E extends Enum<E>> |
fromCommaSeparatedNames(String enumNames,
Class<E> enumType)
Resolve
enum constants from a string of comma separated names. |
static <E extends Enum<E>> |
fromEnumsString(String enumsString,
String delimRegex,
Function<String,E> convertToEnum)
Resolve
enum constants from a string containing identifiers separated by a delimiter. |
static <E extends Enum<E>> |
fromEnumsString(String enumsString,
String delimRegex,
Predicate<String> included,
Function<String,E> convertToEnum)
Resolve
enum constants from a string containing identifiers separated by a delimiter. |
static <E extends Enum<E>> |
toCommaSeparatedNames(Collection<E> enums)
Join several
enum constants to a comma separated string of their names. |
static <E extends Enum<E>> |
toCommaSeparatedNames(E... enums)
Join several
enum constants to a comma separated string of their names. |
static <E extends Enum<E>> |
toNames(String delim,
Collection<E> enums)
|
static <E extends Enum<E>> |
toNames(String delim,
E... enums)
|
static <E extends Enum<E>> |
toStringOf(Function<? super E,String> enumAsString,
Collector<? super String,?,String> joiner,
Collection<E> enums)
Join several
enum constants to a string where each constant is converted to
a string, and joined to one string using a given Collector. |
static <E extends Enum<E>> |
toStringOf(Function<? super E,String> enumAsString,
Collector<? super String,?,String> joiner,
E... enums)
Join several
enum constants to a string where each constant is converted to
a string, and joined to one string using a given Collector. |
static <E extends Enum<E>> |
toStringOf(Function<? super E,String> enumAsString,
String delim,
Collection<E> enums)
Join several
enum constants to a string where each constant is converted to
a string, and separated by the given delimiter. |
static <E extends Enum<E>> |
toStringOf(Function<? super E,String> enumAsString,
String delim,
E... enums)
Join several
enum constants to a string where each constant is converted to
a string, and separated by the given delimiter. |
public static <E extends Enum<E>> Stream<E> fromCommaSeparatedNames(String enumNames, Class<E> enumType)
enum constants from a string of comma separated names. The names must be exactly equal
to the constant names of the given enum type, but may include any whitespace before and/or after
each comma.enumNames - the string containing the comma separated enum names.enumType - the type of the enum.enum constants.public static <E extends Enum<E>> Stream<E> fromCommaSeparated(String enumsString, Function<String,String> toEnumName, Class<E> enumType)
enum constants from a string of comma separated identifiers.
The string may include any whitespace before and/or after each comma.
The identifiers must be converted to enum names using a given Function.enumsString - the string containing the comma separated enum identifiers.toEnumName - the function to convert from the identifiers to enum names.enumType - the type of the enum.enum constants.public static <E extends Enum<E>> Stream<E> fromEnumsString(String enumsString, String delimRegex, Function<String,E> convertToEnum)
enum constants from a string containing identifiers separated by a delimiter.
The identifiers must be converted to enum constants using a given Function.enumsString - the string containing the enum identifiers.delimRegex - the regular expression which is applied to the {code enumString} to split it into
separate identifiers.convertToEnum - the function to convert from the identifiers to enum constants from the identifiers.enum constants.public static <E extends Enum<E>> Stream<E> fromEnumsString(String enumsString, String delimRegex, Predicate<String> included, Function<String,E> convertToEnum)
enum constants from a string containing identifiers separated by a delimiter.
The identifiers must be converted to enum constants using a given Function. In
addition, this method offers a filtering mechanism to only include identifiers which satisfy a Predicate.enumsString - the string containing the enum identifiers.delimRegex - the regular expression which is applied to the {code enumString} to split it into
separate identifiers.included - predicate which is used as a filter on each identifier. Identifiers not satisfying this predicate
will not be attempted to resolve as an enum constant.convertToEnum - the function to convert from the identifiers to enum constants from the identifiers.enum constants.@SafeVarargs public static <E extends Enum<E>> String toCommaSeparatedNames(E... enums)
enum constants to a comma separated string of their names.enums - the enumsenum names.public static <E extends Enum<E>> String toCommaSeparatedNames(Collection<E> enums)
enum constants to a comma separated string of their names.enums - the enumsenum names.@SafeVarargs public static <E extends Enum<E>> String toNames(String delim, E... enums)
delim - the delimiter.enums - the enums.enum names, separated by the delimiter.public static <E extends Enum<E>> String toNames(String delim, Collection<E> enums)
delim - the delimiter.enums - the enums.enum names, separated by the delimiter.@SafeVarargs public static <E extends Enum<E>> String toStringOf(Function<? super E,String> enumAsString, String delim, E... enums)
enum constants to a string where each constant is converted to
a string, and separated by the given delimiter.enumAsString - the function which converts each enum constant to a string.delim - the delimiter.enums - the enums.public static <E extends Enum<E>> String toStringOf(Function<? super E,String> enumAsString, String delim, Collection<E> enums)
enum constants to a string where each constant is converted to
a string, and separated by the given delimiter.enumAsString - the function which converts each enum constant to a string.delim - the delimiter.enums - the enums.@SafeVarargs public static <E extends Enum<E>> String toStringOf(Function<? super E,String> enumAsString, Collector<? super String,?,String> joiner, E... enums)
enum constants to a string where each constant is converted to
a string, and joined to one string using a given Collector.enumAsString - the function which converts each enum constant to a string.joiner - the Collector to join the strings.enums - the enums.public static <E extends Enum<E>> String toStringOf(Function<? super E,String> enumAsString, Collector<? super String,?,String> joiner, Collection<E> enums)
enum constants to a string where each constant is converted to
a string, and joined to one string using a given Collector.enumAsString - the function which converts each enum constant to a string.joiner - the Collector to join the strings.enums - the enums.Copyright © 2019 Digipost. All rights reserved.