类 TypeConverterSupportImpl
- java.lang.Object
-
- cc.shacocloud.mirage.utils.converter.TypeConverterSupportImpl
-
- 所有已实现的接口:
ConversionRegistry,TypeConverter,TypeConverterSupport
public class TypeConverterSupportImpl extends Object implements TypeConverterSupport
- 作者:
- 思追(shaco)
-
-
字段概要
字段 修饰符和类型 字段 说明 protected List<ConversionSupport>conversionSupportCacheprotected Map<ConverterCacheKey,Conversion>explicitConverterCacheprotected Map<TypeDescriptor,Conversion>targetConverterCache
-
构造器概要
构造器 构造器 说明 TypeConverterSupportImpl()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 <T> TconvertIfNecessary(@Nullable Object source, @Nullable Class<T> requiredType, @Nullable TypeDescriptor typeDescriptor)将该值转换为所需的类型protected voiddefaultConversion()默认转换器voidregistry(@NotNull ConversionSupport conversionSupport)注册目标类型转换器voidregistry(@NotNull TypeDescriptor targetType, @NotNull Conversion conversion)注册目标类型转换器voidregistry(@NotNull TypeDescriptor sourceType, @NotNull TypeDescriptor targetType, @NotNull Conversion conversion)注册指定来源和目标类型转换器-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 cc.shacocloud.mirage.utils.converter.ConversionRegistry
registry, registry
-
从接口继承的方法 cc.shacocloud.mirage.utils.converter.TypeConverter
convertIfNecessary, convertIfNecessary
-
-
-
-
字段详细资料
-
explicitConverterCache
protected final Map<ConverterCacheKey,Conversion> explicitConverterCache
-
targetConverterCache
protected final Map<TypeDescriptor,Conversion> targetConverterCache
-
conversionSupportCache
protected final List<ConversionSupport> conversionSupportCache
-
-
方法详细资料
-
convertIfNecessary
@Nullable public <T> T convertIfNecessary(@Nullable @Nullable Object source, @Nullable @Nullable Class<T> requiredType, @Nullable @Nullable TypeDescriptor typeDescriptor) throws TypeMismatchException从接口复制的说明:TypeConverter将该值转换为所需的类型注意:requiredType 或 typeDescriptor 必须有一个不为空!
- 指定者:
convertIfNecessary在接口中TypeConverter- 参数:
source- 要转换的值requiredType- 必须转换为的类型 (如果不知道,则为null,例如在集合元素的情况下)typeDescriptor- 要使用的类型描述符(可能是null))- 返回:
- 类型转换的结果
- 抛出:
TypeMismatchException- 如果类型转换失败,则抛出该例外
-
registry
public void registry(@NotNull @NotNull TypeDescriptor sourceType, @NotNull @NotNull TypeDescriptor targetType, @NotNull @NotNull Conversion conversion)从接口复制的说明:ConversionRegistry注册指定来源和目标类型转换器该转换器优先匹配,如果没有匹配到则匹配
ConversionRegistry.registry(Class, Conversion)注册的转换器- 指定者:
registry在接口中ConversionRegistry- 参数:
sourceType- 来源类型targetType- 目标类型conversion- 转换器
-
registry
public void registry(@NotNull @NotNull TypeDescriptor targetType, @NotNull @NotNull Conversion conversion)从接口复制的说明:ConversionRegistry注册目标类型转换器该转换器滞后匹配,如果
ConversionRegistry.registry(TypeDescriptor, TypeDescriptor, Conversion)没有匹配到则进行匹配- 指定者:
registry在接口中ConversionRegistry- 参数:
targetType- 目标类型conversion- 转换器
-
registry
public void registry(@NotNull @NotNull ConversionSupport conversionSupport)从接口复制的说明:ConversionRegistry注册目标类型转换器该转换器最后匹配,如果
ConversionRegistry.registry(TypeDescriptor, TypeDescriptor, Conversion)和ConversionRegistry.registry(TypeDescriptor, Conversion)没有匹配到则进行匹配- 指定者:
registry在接口中ConversionRegistry- 参数:
conversionSupport- 转换器
-
defaultConversion
protected void defaultConversion()
默认转换器
-
-