JSF-Spring

de.mindmatters.faces.spring.factory
Class DelegatingVariableResolver

java.lang.Object
  extended by javax.faces.el.VariableResolver
      extended by de.mindmatters.faces.spring.factory.DelegatingVariableResolver
All Implemented Interfaces:
BeanFactoryAware

public final class DelegatingVariableResolver
extends VariableResolver
implements BeanFactoryAware

VariableResolver implementation that delegates to the internal BeanFactory of the used WebApplicationContext and original resolver of the underlying JSF implementation to resolve the asked beans or variables.

Author:
Andreas Kuhrwahl
See Also:
ManagedBeanFactory

Constructor Summary
DelegatingVariableResolver(VariableResolver originalVariableResolver)
          Creates a DelegatingVariableResolver with the given VariableResolver originalVariableResolver.
DelegatingVariableResolver(VariableResolver originalVariableResolver, BeanFactory beanFactory)
          Creates a DelegatingVariableResolver with the given VariableResolver originalVariableResolver.
 
Method Summary
 java.lang.Object resolveVariable(FacesContext context, java.lang.String name)
          Checks wether there is a bean with name name in the internal BeanFactory of the used WebApplicationContext and returns it.
 void setBeanFactory(BeanFactory beanFactory)
          Callback that supplies the owning factory to a bean instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingVariableResolver

public DelegatingVariableResolver(VariableResolver originalVariableResolver)
Creates a DelegatingVariableResolver with the given VariableResolver originalVariableResolver.

Parameters:
originalVariableResolver - the original resolver of the underlying JSF implementation

DelegatingVariableResolver

public DelegatingVariableResolver(VariableResolver originalVariableResolver,
                                  BeanFactory beanFactory)
Creates a DelegatingVariableResolver with the given VariableResolver originalVariableResolver.

Parameters:
originalVariableResolver - the original resolver of the underlying JSF implementation
beanFactory - The BeanFactory this VariableResolver uses for bean resolving
Method Detail

resolveVariable

public java.lang.Object resolveVariable(FacesContext context,
                                        java.lang.String name)
Checks wether there is a bean with name name in the internal BeanFactory of the used WebApplicationContext and returns it. Otherwise delegates to the encapsulated original VariableResolver.

Specified by:
resolveVariable in class VariableResolver
Parameters:
context - context against which to resolve the bean name
name - name of the bean to be resolved
Returns:
the resolved object
Throws:
EvaluationException - if an exception is thrown while resolving the variable name
See Also:
VariableResolver.resolveVariable(javax.faces.context.FacesContext, java.lang.String)

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.

Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean.afterPropertiesSet() or a custom init-method.

Specified by:
setBeanFactory in interface BeanFactoryAware
Parameters:
beanFactory - owning BeanFactory (may not be null). The bean can immediately call methods on the factory.
See Also:
BeanInitializationException

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG