| 1 33 34 package com.icesoft.faces.el; 35 36 import org.apache.commons.logging.Log; 37 import org.apache.commons.logging.LogFactory; 38 39 import javax.el.ELContext; 40 import javax.el.ELResolver; 41 import javax.el.FunctionMapper; 42 import javax.el.VariableMapper; 43 import javax.faces.application.Application; 44 import java.lang.reflect.Method ; 45 46 47 public class ELContextImpl extends ELContext { 48 private FunctionMapper functionMapper; 49 private VariableMapper variableMapper; 50 private ELResolver resolver; 51 52 private static final Log log = LogFactory.getLog(ELContextImpl.class); 53 54 public ELContextImpl(Application application) { 55 try { 56 Method getElResolver = 57 Application.class 58 .getDeclaredMethod("getELResolver", (Class []) null); 59 this.resolver = 60 (ELResolver) getElResolver 61 .invoke(application, (Object []) null); 62 } catch (Exception e) { 63 if (log.isErrorEnabled()) { 64 log.error("Failed to instantiate ELResolver. " + e.getMessage(), 65 e); 66 } 67 } 68 } 69 70 public void setFunctionMapper(FunctionMapper functionMapper) { 71 this.functionMapper = functionMapper; 72 } 73 74 public FunctionMapper getFunctionMapper() { 75 return functionMapper; 76 } 77 78 public void setVariableMapper(VariableMapper variableMapper) { 79 this.variableMapper = variableMapper; 80 } 81 82 public VariableMapper getVariableMapper() { 83 return variableMapper; 84 } 85 86 public ELResolver getELResolver() { 87 return resolver; 88 } 89 90 } 91 92 | Popular Tags |