public class

StandardTypeLocator

extends Object
implements TypeLocator
java.lang.Object
   ↳ org.springframework.expression.spel.support.StandardTypeLocator

Class Overview

A default implementation of a 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.

Summary

Public Constructors
StandardTypeLocator()
StandardTypeLocator(ClassLoader loader)
Public Methods
Class<?> findType(String typename)
Find a (possibly unqualified) type reference - first using the typename as is, then trying any registered prefixes if the typename 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)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.expression.TypeLocator

Public Constructors

public StandardTypeLocator ()

public StandardTypeLocator (ClassLoader loader)

Public Methods

public Class<?> findType (String typename)

Find a (possibly unqualified) type reference - first using the typename as is, then trying any registered prefixes if the typename cannot be found.

Parameters
typename the type to locate
Returns
  • the class object for the type
Throws
EvaluationException if the type cannot be found

public List<String> getImportPrefixes ()

Return a list of all the import prefixes registered with this StandardTypeLocator.

Returns
  • list of registered import prefixes

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".

Parameters
prefix the prefix to register

public void removeImport (String prefix)