类 StandardTypeLocator

java.lang.Object
cn.taketoday.core.DefaultAliasRegistry
cn.taketoday.expression.spel.support.StandardTypeLocator
所有已实现的接口:
AliasRegistry, TypeLocator

public class StandardTypeLocator extends DefaultAliasRegistry implements TypeLocator
A simple implementation of TypeLocator 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.
从以下版本开始:
4.0
作者:
Andy Clement, Juergen Hoeller, Harry Yang
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • 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
    • importClass

      public void importClass(String name) throws ExpressionException
      Import a class.
      参数:
      name - The full class name of the class to be imported
      抛出:
      ExpressionException - if the name does not include a ".".
    • importClass

      public void importClass(Class<?> classToImport)
      Import a class.
      另请参阅:
    • registerAlias

      public void registerAlias(Class<?> classToImport, String... alias)
    • findType

      public Class<?> findType(String typeName) throws EvaluationException
      Resolve a class name.
      指定者:
      findType 在接口中 TypeLocator
      参数:
      typeName - The name of the class (without package name) to be resolved.
      返回:
      If the class has been imported previously, with importClass(java.lang.String) or registerImport(String), then its Class instance. Otherwise null.
      抛出:
      ExpressionException - if the class is abstract or is an interface, or not public.
      EvaluationException - if there is a problem finding the type
    • resolveClassFor

      @Nullable private Class<?> resolveClassFor(String className)
    • getClassFor

      @Nullable public Class<?> getClassFor(String className)