类的使用
org.springframework.core.convert.TypeDescriptor
使用TypeDescriptor的程序包 程序包 说明 org.springframework.beans This package contains interfaces and classes for manipulating Java beans.org.springframework.beans.factory.config SPI interfaces and configuration-related convenience classes for bean factories.org.springframework.core.convert Type conversion system API.org.springframework.core.convert.converter SPI to implement Converters for the type conversion system.org.springframework.core.convert.support Default implementation of the type conversion system.org.springframework.expression Core abstractions behind the Spring Expression Language.org.springframework.expression.common Common utility classes behind the Spring Expression Language.org.springframework.expression.spel SpEL's central implementation package.org.springframework.expression.spel.standard SpEL's standard parser implementation.org.springframework.expression.spel.support SpEL's default implementations for various core abstractions.org.springframework.validation Provides data binding and validation functionality, for usage in business and/or UI layers.org.springframework.web.method.annotation Support classes for annotation-based handler method processing.org.springframework.web.servlet.mvc.method.annotation MVC infrastructure for annotation-based handler method processing, building on theorg.springframework.web.method.annotation
package.org.springframework.web.socket.adapter.standard Adapter classes for the standard Java WebSocket API.org.springframework.beans中TypeDescriptor的使用
返回TypeDescriptor的org.springframework.beans中的方法 修饰符和类型 方法 说明 TypeDescriptor
AbstractNestablePropertyAccessor. getPropertyTypeDescriptor(String propertyName)
TypeDescriptor
PropertyAccessor. getPropertyTypeDescriptor(String propertyName)
Return a type descriptor for the specified property: preferably from the read method, falling back to the write method.abstract TypeDescriptor
AbstractNestablePropertyAccessor.PropertyHandler. nested(int level)
abstract TypeDescriptor
AbstractNestablePropertyAccessor.PropertyHandler. toTypeDescriptor()
参数类型为TypeDescriptor的org.springframework.beans中的方法 修饰符和类型 方法 说明 protected Object
AbstractNestablePropertyAccessor. convertForProperty(String propertyName, Object oldValue, Object newValue, TypeDescriptor td)
default <T> T
TypeConverter. convertIfNecessary(Object value, Class<T> requiredType, TypeDescriptor typeDescriptor)
Convert the value to the required type (if necessary from a String).<T> T
TypeConverterSupport. convertIfNecessary(Object value, Class<T> requiredType, TypeDescriptor typeDescriptor)
org.springframework.beans.factory.config中TypeDescriptor的使用
返回TypeDescriptor的org.springframework.beans.factory.config中的方法 修饰符和类型 方法 说明 TypeDescriptor
DependencyDescriptor. getTypeDescriptor()
Build aTypeDescriptor
object for the wrapped parameter/field.org.springframework.core.convert中TypeDescriptor的使用
返回TypeDescriptor的org.springframework.core.convert中的方法 修饰符和类型 方法 说明 static TypeDescriptor
TypeDescriptor. array(TypeDescriptor elementTypeDescriptor)
Create a new type descriptor as an array of the specified type.static TypeDescriptor
TypeDescriptor. collection(Class<?> collectionType, TypeDescriptor elementTypeDescriptor)
Create a new type descriptor from aCollection
type.TypeDescriptor
TypeDescriptor. elementTypeDescriptor(Object element)
If this type is aCollection
or an array, creates a element TypeDescriptor from the provided collection or array element.static TypeDescriptor
TypeDescriptor. forObject(Object source)
Create a new type descriptor for an object.TypeDescriptor
TypeDescriptor. getElementTypeDescriptor()
If this type is an array, returns the array's component type.TypeDescriptor
TypeDescriptor. getMapKeyTypeDescriptor()
If this type is aMap
and its key type is parameterized, returns the map's key type.TypeDescriptor
TypeDescriptor. getMapKeyTypeDescriptor(Object mapKey)
If this type is aMap
, creates a mapKeyTypeDescriptor
from the provided map key.TypeDescriptor
TypeDescriptor. getMapValueTypeDescriptor()
If this type is aMap
and its value type is parameterized, returns the map's value type.TypeDescriptor
TypeDescriptor. getMapValueTypeDescriptor(Object mapValue)
If this type is aMap
, creates a mapValueTypeDescriptor
from the provided map value.TypeDescriptor
ConversionFailedException. getSourceType()
Return the source type we tried to convert the value from.TypeDescriptor
ConverterNotFoundException. getSourceType()
Return the source type that was requested to convert from.TypeDescriptor
ConversionFailedException. getTargetType()
Return the target type we tried to convert the value to.TypeDescriptor
ConverterNotFoundException. getTargetType()
Return the target type that was requested to convert to.static TypeDescriptor
TypeDescriptor. map(Class<?> mapType, TypeDescriptor keyTypeDescriptor, TypeDescriptor valueTypeDescriptor)
Create a new type descriptor from aMap
type.TypeDescriptor
TypeDescriptor. narrow(Object value)
Narrows thisTypeDescriptor
by setting its type to the class of the provided value.static TypeDescriptor
TypeDescriptor. nested(Field field, int nestingLevel)
Create a type descriptor for a nested type declared within the field.static TypeDescriptor
TypeDescriptor. nested(Property property, int nestingLevel)
Create a type descriptor for a nested type declared within the property.static TypeDescriptor
TypeDescriptor. nested(MethodParameter methodParameter, int nestingLevel)
Create a type descriptor for a nested type declared within the method parameter.TypeDescriptor
TypeDescriptor. upcast(Class<?> superType)
Cast thisTypeDescriptor
to a superclass or implemented interface preserving annotations and nested type context.static TypeDescriptor
TypeDescriptor. valueOf(Class<?> type)
Create a new type descriptor from the given type.参数类型为TypeDescriptor的org.springframework.core.convert中的方法 修饰符和类型 方法 说明 static TypeDescriptor
TypeDescriptor. array(TypeDescriptor elementTypeDescriptor)
Create a new type descriptor as an array of the specified type.boolean
ConversionService. canConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
Returntrue
if objects ofsourceType
can be converted to thetargetType
.static TypeDescriptor
TypeDescriptor. collection(Class<?> collectionType, TypeDescriptor elementTypeDescriptor)
Create a new type descriptor from aCollection
type.Object
ConversionService. convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
Convert the givensource
to the specifiedtargetType
.boolean
TypeDescriptor. isAssignableTo(TypeDescriptor typeDescriptor)
Returns true if an object of this type descriptor can be assigned to the location described by the given type descriptor.static TypeDescriptor
TypeDescriptor. map(Class<?> mapType, TypeDescriptor keyTypeDescriptor, TypeDescriptor valueTypeDescriptor)
Create a new type descriptor from aMap
type.参数类型为TypeDescriptor的org.springframework.core.convert中的构造器 构造器 说明 ConversionFailedException(TypeDescriptor sourceType, TypeDescriptor targetType, Object value, Throwable cause)
Create a new conversion exception.ConverterNotFoundException(TypeDescriptor sourceType, TypeDescriptor targetType)
Create a new conversion executor not found exception.org.springframework.core.convert.converter中TypeDescriptor的使用
参数类型为TypeDescriptor的org.springframework.core.convert.converter中的方法 修饰符和类型 方法 说明 Object
GenericConverter. convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
Convert the source object to the targetType described by theTypeDescriptor
.boolean
ConditionalConverter. matches(TypeDescriptor sourceType, TypeDescriptor targetType)
Should the conversion fromsourceType
totargetType
currently under consideration be selected?org.springframework.core.convert.support中TypeDescriptor的使用
参数类型为TypeDescriptor的org.springframework.core.convert.support中的方法 修饰符和类型 方法 说明 boolean
GenericConversionService. canBypassConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
Return whether conversion between the source type and the target type can be bypassed.boolean
GenericConversionService. canConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
Object
GenericConversionService. convert(Object source, 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.Object
GenericConversionService. convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
protected Object
GenericConversionService. convertNullSource(TypeDescriptor sourceType, TypeDescriptor targetType)
Template method to convert anull
source.protected GenericConverter
GenericConversionService. getConverter(TypeDescriptor sourceType, TypeDescriptor targetType)
Hook method to lookup the converter for a given sourceType/targetType pair.protected GenericConverter
GenericConversionService. getDefaultConverter(TypeDescriptor sourceType, TypeDescriptor targetType)
Return the default converter if no converter is found for the given sourceType/targetType pair.参数类型为TypeDescriptor的org.springframework.core.convert.support中的构造器 构造器 说明 ConvertingPropertyEditorAdapter(ConversionService conversionService, TypeDescriptor targetDescriptor)
Create a new ConvertingPropertyEditorAdapter for a givenConversionService
and the given target type.org.springframework.expression中TypeDescriptor的使用
返回TypeDescriptor的org.springframework.expression中的方法 修饰符和类型 方法 说明 TypeDescriptor
TypedValue. getTypeDescriptor()
TypeDescriptor
Expression. getValueTypeDescriptor()
Return the most general type that can be passed to aExpression.setValue(java.lang.Object, java.lang.Object)
method using the default context.TypeDescriptor
Expression. getValueTypeDescriptor(Object rootObject)
Return the most general type that can be passed to theExpression.setValue(Object, Object)
method using the default context.TypeDescriptor
Expression. getValueTypeDescriptor(EvaluationContext context)
Return the most general type that can be passed to theExpression.setValue(EvaluationContext, Object)
method for the given context.TypeDescriptor
Expression. getValueTypeDescriptor(EvaluationContext context, Object rootObject)
Return the most general type that can be passed to theExpression.setValue(EvaluationContext, Object, Object)
method for the given context.参数类型为TypeDescriptor的org.springframework.expression中的方法 修饰符和类型 方法 说明 boolean
TypeConverter. canConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
Returntrue
if the type converter can convert the specified type to the desired target type.Object
TypeConverter. convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType)
Convert (or coerce) a value from one type to another, for example from aboolean
to aString
.类型变量类型为TypeDescriptor的org.springframework.expression中的方法参数 修饰符和类型 方法 说明 ConstructorExecutor
ConstructorResolver. resolve(EvaluationContext context, String typeName, List<TypeDescriptor> argumentTypes)
Within the supplied context determine a suitable constructor on the supplied type that can handle the specified arguments.MethodExecutor
MethodResolver. resolve(EvaluationContext context, Object targetObject, String name, List<TypeDescriptor> argumentTypes)
Within the supplied context determine a suitable method on the supplied object that can handle the specified arguments.参数类型为TypeDescriptor的org.springframework.expression中的构造器 构造器 说明 TypedValue(Object value, TypeDescriptor typeDescriptor)
Create aTypedValue
for a particular value with a particularTypeDescriptor
which may contain additional generic declarations.org.springframework.expression.common中TypeDescriptor的使用
返回TypeDescriptor的org.springframework.expression.common中的方法 修饰符和类型 方法 说明 TypeDescriptor
CompositeStringExpression. getValueTypeDescriptor()
TypeDescriptor
CompositeStringExpression. getValueTypeDescriptor(Object rootObject)
TypeDescriptor
CompositeStringExpression. getValueTypeDescriptor(EvaluationContext context)
TypeDescriptor
CompositeStringExpression. getValueTypeDescriptor(EvaluationContext context, Object rootObject)
TypeDescriptor
LiteralExpression. getValueTypeDescriptor()
TypeDescriptor
LiteralExpression. getValueTypeDescriptor(Object rootObject)
TypeDescriptor
LiteralExpression. getValueTypeDescriptor(EvaluationContext context)
TypeDescriptor
LiteralExpression. getValueTypeDescriptor(EvaluationContext context, Object rootObject)
org.springframework.expression.spel中TypeDescriptor的使用
参数类型为TypeDescriptor的org.springframework.expression.spel中的方法 修饰符和类型 方法 说明 Object
ExpressionState. convertValue(Object value, TypeDescriptor targetTypeDescriptor)
Object
ExpressionState. convertValue(TypedValue value, TypeDescriptor targetTypeDescriptor)
org.springframework.expression.spel.standard中TypeDescriptor的使用
返回TypeDescriptor的org.springframework.expression.spel.standard中的方法 修饰符和类型 方法 说明 TypeDescriptor
SpelExpression. getValueTypeDescriptor()
TypeDescriptor
SpelExpression. getValueTypeDescriptor(Object rootObject)
TypeDescriptor
SpelExpression. getValueTypeDescriptor(EvaluationContext context)
TypeDescriptor
SpelExpression. getValueTypeDescriptor(EvaluationContext context, Object rootObject)
org.springframework.expression.spel.support中TypeDescriptor的使用
参数类型为TypeDescriptor的org.springframework.expression.spel.support中的方法 修饰符和类型 方法 说明 boolean
StandardTypeConverter. canConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
Object
StandardTypeConverter. convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType)
void
StandardEvaluationContext. setRootObject(Object rootObject, TypeDescriptor typeDescriptor)
SimpleEvaluationContext.Builder
SimpleEvaluationContext.Builder. withTypedRootObject(Object rootObject, TypeDescriptor typeDescriptor)
Specify a typed root object to resolve against.类型变量类型为TypeDescriptor的org.springframework.expression.spel.support中的方法参数 修饰符和类型 方法 说明 static int
ReflectionHelper. getTypeDifferenceWeight(List<TypeDescriptor> paramTypes, List<TypeDescriptor> argTypes)
Based onMethodInvoker.getTypeDifferenceWeight(Class[], Object[])
but operates on TypeDescriptors.MethodExecutor
DataBindingMethodResolver. resolve(EvaluationContext context, Object targetObject, String name, List<TypeDescriptor> argumentTypes)
ConstructorExecutor
ReflectiveConstructorResolver. resolve(EvaluationContext context, String typeName, List<TypeDescriptor> argumentTypes)
Locate a constructor on the type.MethodExecutor
ReflectiveMethodResolver. resolve(EvaluationContext context, Object targetObject, String name, List<TypeDescriptor> argumentTypes)
Locate a method on a type.org.springframework.validation中TypeDescriptor的使用
参数类型为TypeDescriptor的org.springframework.validation中的方法 修饰符和类型 方法 说明 <T> T
DataBinder. convertIfNecessary(Object value, Class<T> requiredType, TypeDescriptor typeDescriptor)
org.springframework.web.method.annotation中TypeDescriptor的使用
参数类型为TypeDescriptor的org.springframework.web.method.annotation中的方法 修饰符和类型 方法 说明 protected String
RequestParamMethodArgumentResolver. formatUriValue(ConversionService cs, TypeDescriptor sourceType, Object value)
org.springframework.web.servlet.mvc.method.annotation中TypeDescriptor的使用
参数类型为TypeDescriptor的org.springframework.web.servlet.mvc.method.annotation中的方法 修饰符和类型 方法 说明 protected String
PathVariableMethodArgumentResolver. formatUriValue(ConversionService cs, TypeDescriptor sourceType, Object value)
org.springframework.web.socket.adapter.standard中TypeDescriptor的使用
返回TypeDescriptor的org.springframework.web.socket.adapter.standard中的方法 修饰符和类型 方法 说明 protected TypeDescriptor
ConvertingEncoderDecoderSupport. getMessageType()
Returns the websocket message type.protected TypeDescriptor
ConvertingEncoderDecoderSupport. getType()
Returns the type being converted.