-
public final class ComponentExtensions
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Tconvert(Object $self, Map<String, Object> configParams)根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则抛出异常。 final static <T extends Any> Tconvert(Object $self, Class<T> targetType, Map<String, Object> configParams)根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则抛出异常。 final static Objectconvert(Object $self, Type targetType, Map<String, Object> configParams)根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则抛出异常。 final static <T extends Any> TconvertOrNull(Object $self, Map<String, Object> configParams)根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则返回null。 final static <T extends Any> TconvertOrNull(Object $self, Class<T> targetType, Map<String, Object> configParams)根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则返回null。 final static ObjectconvertOrNull(Object $self, Type targetType, Map<String, Object> configParams)根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则返回null。 final static StringencodeBy(String $self, Encoder encoder, Charset charset)根据指定的编码器,编码当前字符串,以指定的字符集显示。 final static StringdecodeBy(String $self, Encoder encoder, Charset charset)根据指定的编码器,解码当前字符串,以指定的字符集显示。 final static ByteArrayencryptBy(ByteArray $self, Encrypter encrypter, ByteArray secret)根据指定的加密器,加密当前字节数组。 final static ByteArraydecryptBy(ByteArray $self, Encrypter encrypter, ByteArray secret)根据指定的加密器,解密当前字符串。某些加密算法可能不支持解密。 final static StringescapeBy(String $self, Escaper escaper)根据指定的转义器,转义当前字符串。 final static StringunescapeBy(String $self, Escaper escaper)根据指定的转义器,反转义当前字符串。 final static <T extends Any> TdefaultValue(Map<String, Object> configParams)根据可选的配置参数,生成指定类型的默认值。 final static <T extends Any> TdefaultValue(Class<T> targetType, Map<String, Object> configParams)根据可选的配置参数,生成指定类型的默认值。 final static <T extends Any> TdefaultValue(Type targetType, Map<String, Object> configParams)根据可选的配置参数,生成指定类型的默认值。 final static <T extends Any> TrandomValue(Map<String, Object> configParams)根据可选的配置参数,生成指定类型的随机值。 final static <T extends Any> TrandomValue(Class<T> targetType, Map<String, Object> configParams)根据可选的配置参数,生成指定类型的随机值。 final static <T extends Any> TrandomValue(Type targetType, Map<String, Object> configParams)根据可选的配置参数,生成指定类型的随机值。 final static BooleanmatchesBy(String $self, StringPattern stringPattern)判断指定的字符串是否匹配指定的字符串模式。 final static BooleanmatchesBy(String $self, String path, PathPattern pathPattern)根据指定的路径类型,判断当前字符串是否匹配指定的路径。 默认使用标准路径PathPattern.StandardPath。 final static BooleanmatchesBy(String $self, LetterCase letterCase)判断当前字符串是否匹配指定的字母格式。 final static Map<String, String>resolveVariablesBy(String $self, String path, PathPattern pathPattern)根据指定的路径类型,解析路径变量。如果路径不匹配,则返回空结果。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> List<T>queryBy(Array<?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型查询当前数组,返回查询结果列表。 如果指定路径为空路径,则目标返回查询对象的单例列表。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> List<T>queryBy(List<?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型查询当前列表,返回查询结果列表。 如果指定路径为空路径,则目标返回查询对象的单例列表。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> List<T>queryBy(Map<?, ?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型递归查询当前映射,返回查询结果列表。 如果指定路径为空路径,则目标返回查询对象的单例列表。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetBy(Array<?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者抛出异常。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetBy(List<?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者抛出异常。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetBy(Map<?, ?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者抛出异常。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrNullBy(Array<?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrNullBy(List<?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrNullBy(Map<?, ?> $self, String path, PathPattern pathPattern)根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrDefaultBy(Array<?> $self, String path, PathPattern pathPattern, T defaultValue)根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrDefaultBy(List<?> $self, String path, PathPattern pathPattern, T defaultValue)根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrDefaultBy(Map<?, ?> $self, String path, PathPattern pathPattern, T defaultValue)根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrElseBy(Array<?> $self, String path, PathPattern pathPattern, Function0<T> defaultValue)根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrElseBy(List<?> $self, String path, PathPattern pathPattern, Function0<T> defaultValue)根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static <T extends Any> TgetOrElseBy(Map<?, ?> $self, String path, PathPattern pathPattern, Function0<T> defaultValue)根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。 final static LetterCaseinferCase(String $self)尝试推断当前字符串的字母格式。 final static List<String>splitBy(String $self, LetterCase letterCase)根据指定的字母格式,分割当前字符串,返回对应的字符串列表。 final static Sequence<String>splitToSequenceBy(String $self, LetterCase letterCase)根据指定的字母格式,分割当前字符串,返回对应的字符串序列。 final static StringjoinToStringBy(Array<String> $self, LetterCase letterCase)根据指定的字母格式,将当前字符串数组中的元素加入到字符串。 final static StringjoinToStringBy(Iterable<String> $self, LetterCase letterCase)根据指定的字母格式,将当前字符串集合中的元素加入到字符串。 final static StringjoinToStringBy(Sequence<String> $self, LetterCase letterCase)根据指定的字母格式,将当前字符串序列中的元素加入到字符串。 final static StringswitchCaseBy(String $self, LetterCase sourceLetterCase, LetterCase targetLetterCase)根据指定的字母格式,切换当前字符串的格式。 final static StringswitchCaseBy(String $self, LetterCase targetLetterCase)根据指定的字母格式,切换当前字符串的格式。如果不指定字母格式,则尝试推断或者抛出异常。 -
-
Method Detail
-
convert
final static <T extends Any> T convert(Object $self, Map<String, Object> configParams)
根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则抛出异常。
-
convert
final static <T extends Any> T convert(Object $self, Class<T> targetType, Map<String, Object> configParams)
根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则抛出异常。
-
convert
final static Object convert(Object $self, Type targetType, Map<String, Object> configParams)
根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则抛出异常。
-
convertOrNull
final static <T extends Any> T convertOrNull(Object $self, Map<String, Object> configParams)
根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则返回null。
-
convertOrNull
final static <T extends Any> T convertOrNull(Object $self, Class<T> targetType, Map<String, Object> configParams)
根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则返回null。
-
convertOrNull
final static Object convertOrNull(Object $self, Type targetType, Map<String, Object> configParams)
根据可选的配置参数,将当前对象转化为指定类型。如果转换失败,则返回null。
-
encodeBy
final static String encodeBy(String $self, Encoder encoder, Charset charset)
根据指定的编码器,编码当前字符串,以指定的字符集显示。
-
decodeBy
final static String decodeBy(String $self, Encoder encoder, Charset charset)
根据指定的编码器,解码当前字符串,以指定的字符集显示。
-
encryptBy
final static ByteArray encryptBy(ByteArray $self, Encrypter encrypter, ByteArray secret)
根据指定的加密器,加密当前字节数组。
-
decryptBy
final static ByteArray decryptBy(ByteArray $self, Encrypter encrypter, ByteArray secret)
根据指定的加密器,解密当前字符串。某些加密算法可能不支持解密。
-
unescapeBy
final static String unescapeBy(String $self, Escaper escaper)
根据指定的转义器,反转义当前字符串。
-
defaultValue
final static <T extends Any> T defaultValue(Map<String, Object> configParams)
根据可选的配置参数,生成指定类型的默认值。
-
defaultValue
final static <T extends Any> T defaultValue(Class<T> targetType, Map<String, Object> configParams)
根据可选的配置参数,生成指定类型的默认值。
-
defaultValue
final static <T extends Any> T defaultValue(Type targetType, Map<String, Object> configParams)
根据可选的配置参数,生成指定类型的默认值。
-
randomValue
final static <T extends Any> T randomValue(Map<String, Object> configParams)
根据可选的配置参数,生成指定类型的随机值。
-
randomValue
final static <T extends Any> T randomValue(Class<T> targetType, Map<String, Object> configParams)
根据可选的配置参数,生成指定类型的随机值。
-
randomValue
final static <T extends Any> T randomValue(Type targetType, Map<String, Object> configParams)
根据可选的配置参数,生成指定类型的随机值。
-
matchesBy
final static Boolean matchesBy(String $self, StringPattern stringPattern)
判断指定的字符串是否匹配指定的字符串模式。
-
matchesBy
final static Boolean matchesBy(String $self, String path, PathPattern pathPattern)
根据指定的路径类型,判断当前字符串是否匹配指定的路径。 默认使用标准路径PathPattern.StandardPath。
-
matchesBy
final static Boolean matchesBy(String $self, LetterCase letterCase)
判断当前字符串是否匹配指定的字母格式。
-
resolveVariablesBy
final static Map<String, String> resolveVariablesBy(String $self, String path, PathPattern pathPattern)
根据指定的路径类型,解析路径变量。如果路径不匹配,则返回空结果。 默认使用标准路径PathPattern.StandardPath。
-
queryBy
final static <T extends Any> List<T> queryBy(Array<?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型查询当前数组,返回查询结果列表。 如果指定路径为空路径,则目标返回查询对象的单例列表。 默认使用标准路径PathPattern.StandardPath。
-
queryBy
final static <T extends Any> List<T> queryBy(List<?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型查询当前列表,返回查询结果列表。 如果指定路径为空路径,则目标返回查询对象的单例列表。 默认使用标准路径PathPattern.StandardPath。
-
queryBy
final static <T extends Any> List<T> queryBy(Map<?, ?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型递归查询当前映射,返回查询结果列表。 如果指定路径为空路径,则目标返回查询对象的单例列表。 默认使用标准路径PathPattern.StandardPath。
-
getBy
final static <T extends Any> T getBy(Array<?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者抛出异常。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getBy
final static <T extends Any> T getBy(List<?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者抛出异常。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getBy
final static <T extends Any> T getBy(Map<?, ?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者抛出异常。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrNullBy
final static <T extends Any> T getOrNullBy(Array<?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrNullBy
final static <T extends Any> T getOrNullBy(List<?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrNullBy
final static <T extends Any> T getOrNullBy(Map<?, ?> $self, String path, PathPattern pathPattern)
根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrDefaultBy
final static <T extends Any> T getOrDefaultBy(Array<?> $self, String path, PathPattern pathPattern, T defaultValue)
根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrDefaultBy
final static <T extends Any> T getOrDefaultBy(List<?> $self, String path, PathPattern pathPattern, T defaultValue)
根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrDefaultBy
final static <T extends Any> T getOrDefaultBy(Map<?, ?> $self, String path, PathPattern pathPattern, T defaultValue)
根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrElseBy
final static <T extends Any> T getOrElseBy(Array<?> $self, String path, PathPattern pathPattern, Function0<T> defaultValue)
根据指定路径和指定路径类型查询当前数组,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrElseBy
final static <T extends Any> T getOrElseBy(List<?> $self, String path, PathPattern pathPattern, Function0<T> defaultValue)
根据指定路径和指定路径类型查询当前列表,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
getOrElseBy
final static <T extends Any> T getOrElseBy(Map<?, ?> $self, String path, PathPattern pathPattern, Function0<T> defaultValue)
根据指定路径和指定路径类型递归查询当前映射,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则目标返回查询对象本身。 默认使用标准路径PathPattern.StandardPath。
-
inferCase
final static LetterCase inferCase(String $self)
尝试推断当前字符串的字母格式。
-
splitBy
final static List<String> splitBy(String $self, LetterCase letterCase)
根据指定的字母格式,分割当前字符串,返回对应的字符串列表。
-
splitToSequenceBy
final static Sequence<String> splitToSequenceBy(String $self, LetterCase letterCase)
根据指定的字母格式,分割当前字符串,返回对应的字符串序列。
-
joinToStringBy
final static String joinToStringBy(Array<String> $self, LetterCase letterCase)
根据指定的字母格式,将当前字符串数组中的元素加入到字符串。
-
joinToStringBy
final static String joinToStringBy(Iterable<String> $self, LetterCase letterCase)
根据指定的字母格式,将当前字符串集合中的元素加入到字符串。
-
joinToStringBy
final static String joinToStringBy(Sequence<String> $self, LetterCase letterCase)
根据指定的字母格式,将当前字符串序列中的元素加入到字符串。
-
switchCaseBy
final static String switchCaseBy(String $self, LetterCase sourceLetterCase, LetterCase targetLetterCase)
根据指定的字母格式,切换当前字符串的格式。
-
switchCaseBy
final static String switchCaseBy(String $self, LetterCase targetLetterCase)
根据指定的字母格式,切换当前字符串的格式。如果不指定字母格式,则尝试推断或者抛出异常。
-
-
-
-