String eval ( String expr , Map < String , ? extends Object > model ) throws TemplateException { if ( expr == null ) { throw new IllegalArgumentException ( "expr cannot be null" ) ; } try { Template t = new Template ( "t" , "${(" + expr . trim ( ) + ")?c}" , this . cfg ) ; StringWriter w = new StringWriter ( ) ; try ( StringWriter ww = w ) { t . process ( model , ww ) ; } return w . toString ( ) ; } catch ( IOException ex ) { throw new AssertionError ( ex ) ; } }
Evaluates a string as a Freemarker Template Language expression .