类 StandardTypeLocator
- java.lang.Object
- org.springframework.expression.spel.support.StandardTypeLocator
- 所有已实现的接口:
TypeLocator
public class StandardTypeLocator extends Object implements TypeLocator
A simple implementation ofTypeLocator
that uses the context ClassLoader (or any ClassLoader set upon it). It supports 'well-known' packages: So if a type cannot be found, it will try the registered imports to locate it.- 从以下版本开始:
- 3.0
- 作者:
- Andy Clement, Juergen Hoeller
构造器概要
构造器 构造器 说明 StandardTypeLocator()
Create a StandardTypeLocator for the default ClassLoader (typically, the thread context ClassLoader).StandardTypeLocator(ClassLoader classLoader)
Create a StandardTypeLocator for the given ClassLoader.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Class<?>
findType(String typeName)
Find a (possibly unqualified) type reference - first using the type name as-is, then trying any registered prefixes if the type name cannot be found.List<String>
getImportPrefixes()
Return a list of all the import prefixes registered with this StandardTypeLocator.void
registerImport(String prefix)
Register a new import prefix that will be used when searching for unqualified types.void
removeImport(String prefix)
Remove that specified prefix from this locator's list of imports.
构造器详细资料
StandardTypeLocator
public StandardTypeLocator()
Create a StandardTypeLocator for the default ClassLoader (typically, the thread context ClassLoader).
StandardTypeLocator
public StandardTypeLocator(ClassLoader classLoader)
Create a StandardTypeLocator for the given ClassLoader.- 参数:
classLoader
- the ClassLoader to delegate to
方法详细资料
registerImport
public void registerImport(String prefix)
Register a new import prefix that will be used when searching for unqualified types. Expected format is something like "java.lang".- 参数:
prefix
- the prefix to register
removeImport
public void removeImport(String prefix)
Remove that specified prefix from this locator's list of imports.- 参数:
prefix
- the prefix to remove
getImportPrefixes
public List<String> getImportPrefixes()
Return a list of all the import prefixes registered with this StandardTypeLocator.- 返回:
- a list of registered import prefixes
findType
public Class<?> findType(String typeName) throws EvaluationException
Find a (possibly unqualified) type reference - first using the type name as-is, then trying any registered prefixes if the type name cannot be found.- 指定者:
findType
在接口中TypeLocator
- 参数:
typeName
- the type to locate- 返回:
- the class object for the type
- 抛出:
EvaluationException
- if the type cannot be found