package com.hubspot.jinjava.el;

import java.lang.reflect.Method;

import javax.el.ELResolver;
import javax.el.FunctionMapper;

import de.odysseus.el.util.SimpleContext;

public class JinjavaELContext extends SimpleContext {

  private MacroFunctionMapper functionMapper;

  public JinjavaELContext() {
    super();
  }

  public JinjavaELContext(ELResolver resolver) {
    super(resolver);
  }

  @Override
  public FunctionMapper getFunctionMapper() {
    if (functionMapper == null) {
      functionMapper = new MacroFunctionMapper();
    }
    return functionMapper;
  }

  @Override
  public void setFunction(String prefix, String localName, Method method) {
    if (functionMapper == null) {
      functionMapper = new MacroFunctionMapper();
    }
    functionMapper.setFunction(prefix, localName, method);
  }

}

@@ -410,16 +410,21 @@
  public 
+Macro
 Function
@@ -670,112 +670,27 @@
     
-if (functionMapper == null) %7B%0A      functionMapper = new MacroFunctionMapper();%0A    %7D%0A    functionMapper
+getFunctionMapper()
 .set

Simplify ELContext