接口 Converter<S,T>
-
- 类型参数:
S- The source typeT- The target type
- 所有超级接口:
Comparable<Prioritized>,Prioritized
- 所有已知子接口:
StringConverter<T>
- 所有已知实现类:
StringToBooleanConverter,StringToCharacterConverter,StringToCharArrayConverter,StringToDoubleConverter,StringToFloatConverter,StringToIntegerConverter,StringToLongConverter,StringToOptionalConverter,StringToShortConverter,StringToStringConverter
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@SPI @FunctionalInterface public interface Converter<S,T> extends Prioritized
A class to convert the source-typed value to the target-typed value- 从以下版本开始:
- 2.7.6
-
-
字段概要
-
从接口继承的字段 org.apache.dubbo.common.lang.Prioritized
COMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
方法概要
所有方法 静态方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default booleanaccept(Class<?> sourceType, Class<?> targetType)Accept the source type and target type or notTconvert(S source)Convert the source-typed value to the target-typed valuestatic <T> TconvertIfPossible(Object source, Class<T> targetType)Convert the value of source to target-type value if possiblestatic Converter<?,?>getConverter(Class<?> sourceType, Class<?> targetType)Get the Converter instance fromExtensionLoaderwith the specified source and target typedefault Class<S>getSourceType()Get the source typedefault Class<T>getTargetType()Get the target type-
从接口继承的方法 org.apache.dubbo.common.lang.Prioritized
compareTo, getPriority
-
-
-
-
方法详细资料
-
accept
default boolean accept(Class<?> sourceType, Class<?> targetType)
Accept the source type and target type or not- 参数:
sourceType- the source typetargetType- the target type- 返回:
- if accepted, return
true, orfalse
-
convert
T convert(S source)
Convert the source-typed value to the target-typed value- 参数:
source- the source-typed value- 返回:
- the target-typed value
-
getConverter
static Converter<?,?> getConverter(Class<?> sourceType, Class<?> targetType)
Get the Converter instance fromExtensionLoaderwith the specified source and target type- 参数:
sourceType- the source typetargetType- the target type- 返回:
- 另请参阅:
ExtensionLoader.getSupportedExtensionInstances()
-
-