public class ConvertUtil extends Object
| Constructor and Description |
|---|
ConvertUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
convert(Object source,
Class<T> targetType)
Convenience operation for converting a source object to the specified targetType.
|
static <T> T |
convert(Object source,
org.springframework.core.convert.TypeDescriptor targetType)
Convenience operation for converting a source object to the specified targetType,
where the target type is a descriptor that provides additional conversion context.
|
static <T> T |
convert(Object source,
org.springframework.core.convert.TypeDescriptor sourceType,
org.springframework.core.convert.TypeDescriptor targetType)
Convenience operation for converting a source object to the specified targetType,
where the target type is a descriptor that provides additional conversion context.
|
@Nullable
public static <T> T convert(@Nullable
Object source,
Class<T> targetType)
TypeDescriptor.forObject(Object).T - 泛型标记source - the source objecttargetType - the target typeIllegalArgumentException - if targetType is null,
or sourceType is null but source is not null@Nullable
public static <T> T convert(@Nullable
Object source,
org.springframework.core.convert.TypeDescriptor sourceType,
org.springframework.core.convert.TypeDescriptor targetType)
TypeDescriptor.forObject(Object).T - 泛型标记source - the source objectsourceType - the source typetargetType - the target typeIllegalArgumentException - if targetType is null,
or sourceType is null but source is not null@Nullable
public static <T> T convert(@Nullable
Object source,
org.springframework.core.convert.TypeDescriptor targetType)
convert(Object, TypeDescriptor, TypeDescriptor) and
encapsulates the construction of the source type descriptor using
TypeDescriptor.forObject(Object).T - 泛型标记source - the source objecttargetType - the target typeIllegalArgumentException - if targetType is null,
or sourceType is null but source is not nullCopyright © 2024. All rights reserved.