- java.lang.Object
-
- javax.el.ELManager
-
public class ELManager extends Object
Manages EL parsing and evaluation environment. The ELManager maintains an instance of ExpressionFactory and StandardELContext, for parsing and evaluating EL expressions.
- Since:
- EL 3.0
-
-
Constructor Summary
Constructors Constructor and Description ELManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addBeanNameResolver(BeanNameResolver bnr)
Register a BeanNameResolver.void
addELResolver(ELResolver elr)
Add an user defined ELResolver to the list of ELResolvers.void
addEvaluationListener(EvaluationListener listener)
Register an evaluation listener.Object
defineBean(String name, Object bean)
Define a bean in the local bean repositoryStandardELContext
getELContext()
Return the ELContext used for parsing and evaluating EL expressions.static ExpressionFactory
getExpressionFactory()
Return the ExpressionFactory instance used for EL evaluations.void
importClass(String className)
Import a class.void
importPackage(String packageName)
Import a package.void
importStatic(String staticMemberName)
Import a static field or method.void
mapFunction(String prefix, String function, Method meth)
Maps a static method to an EL function.ELContext
setELContext(ELContext context)
Set the ELContext used for parsing and evaluating EL expressions.void
setVariable(String variable, ValueExpression expression)
Assign a ValueExpression to an EL variable, replacing any previous assignment to the same variable.
-
-
-
Method Detail
-
getExpressionFactory
public static ExpressionFactory getExpressionFactory()
Return the ExpressionFactory instance used for EL evaluations.- Returns:
- The ExpressionFactory
-
getELContext
public StandardELContext getELContext()
Return the ELContext used for parsing and evaluating EL expressions. If there is currently no ELContext, a default instance of StandardELContext is returned.- Returns:
- The ELContext used for parsing and evaluating EL expressions..
-
setELContext
public ELContext setELContext(ELContext context)
Set the ELContext used for parsing and evaluating EL expressions. The supplied ELContext will not be modified, except for the context object map.- Parameters:
context
- The new ELContext.- Returns:
- The previous ELContext, null if none.
-
addBeanNameResolver
public void addBeanNameResolver(BeanNameResolver bnr)
Register a BeanNameResolver. Construct a BeanNameELResolver with the BeanNameResolver and add it to the list of ELResolvers. Once registered, the BeanNameResolver cannot be removed.- Parameters:
bnr
- The BeanNameResolver to be registered.
-
addELResolver
public void addELResolver(ELResolver elr)
Add an user defined ELResolver to the list of ELResolvers. Can be called multiple times. The new ELResolver is placed ahead of the default ELResolvers. The list of the ELResolvers added this way are ordered chronologically.- Parameters:
elr
- The ELResolver to be added to the list of ELResolvers in ELContext.- See Also:
StandardELContext.addELResolver(javax.el.ELResolver)
-
mapFunction
public void mapFunction(String prefix, String function, Method meth)
Maps a static method to an EL function.- Parameters:
prefix
- The namespace of the functions, can be "".function
- The name of the function.meth
- The static method to be invoked when the function is used.
-
setVariable
public void setVariable(String variable, ValueExpression expression)
Assign a ValueExpression to an EL variable, replacing any previous assignment to the same variable. The assignment for the variable is removed if the expression isnull
.- Parameters:
variable
- The variable nameexpression
- The ValueExpression to be assigned to the variable.
-
importStatic
public void importStatic(String staticMemberName) throws ELException
Import a static field or method. The class of the static member must be loadable from the classloader, at class resolution time.- Parameters:
staticMemberName
- The full class name of the class to be imported- Throws:
ELException
- if the name is not a full class name.
-
importClass
public void importClass(String className) throws ELException
Import a class. The imported class must be loadable from the classloader at the expression evaluation time.- Parameters:
className
- The full class name of the class to be imported- Throws:
ELException
- if the name is not a full class name.
-
importPackage
public void importPackage(String packageName)
Import a package. At the expression evaluation time, the imported package name will be used to construct the full class name, which will then be used to load the class. Inherently, this is less efficient than importing a class.- Parameters:
packageName
- The package name to be imported
-
defineBean
public Object defineBean(String name, Object bean)
Define a bean in the local bean repository- Parameters:
name
- The name of the beanbean
- The bean instance to be defined. If null, the definition of the bean is removed.
-
addEvaluationListener
public void addEvaluationListener(EvaluationListener listener)
Register an evaluation listener.- Parameters:
listener
- The evaluation listener to be added.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/el/elmanager.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.