String transformInternal(String template, String sourceName, Map<String, Object> model, ModelAdaptor modelAdaptor, ProcessListener processListener) { Locale locale = Locale.getDefault(); return transformInternal(template, locale, sourceName, model, modelAdaptor, processListener); }
String transformInternal(String template, String sourceName, Map<String, Object> model, ModelAdaptor modelAdaptor, ProcessListener processListener) { Locale locale = Locale.getDefault(); return transformInternal(template, locale, sourceName, model, modelAdaptor, processListener); }
/** * Replacement for {@link java.lang.String.format}. All arguments will be * put into the model having their index starting from 1 as their name. * * @param pattern * the template * @param args * any number of arguments * @return the expanded template */ public synchronized String format(final String pattern, final Object... args) { Map<String, Object> model = Collections.emptyMap(); ModelAdaptor modelAdaptor = new ModelAdaptor() { @Override public Object getValue(TemplateContext context, Token token, List<String> segments, String expression) { int index = Integer.parseInt(expression) - 1; return args[index]; } }; String output = transformInternal(pattern, null, model, modelAdaptor, null); return output; }
/** * Replacement for {@link java.lang.String#format(String, Object...)}. All arguments will be * put into the model having their index starting from 1 as their name. * * @param pattern * the template * @param args * any number of arguments * @return the expanded template */ public synchronized String format(final String pattern, final Object... args) { Map<String, Object> model = Collections.emptyMap(); ModelAdaptor modelAdaptor = new ModelAdaptor() { @Override public Object getValue(TemplateContext context, Token token, List<String> segments, String expression) { int index = Integer.parseInt(expression) - 1; return args[index]; } @Override public Iterable<Object> getIterable(Object value) { return null; } @Override public String getSpecialIteratorVariable() { return null; } }; String output = transformInternal(pattern, null, model, modelAdaptor, null); return output; }
public synchronized String transform(String template, Locale locale, Map<String, Object> model) { return transformInternal(template, locale, null, model, getModelAdaptor(), null); }
public synchronized String transform(String template, Locale locale, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, locale, null, model, getModelAdaptor(), processListener); }
public synchronized String transform(String template, String sourceName, Map<String, Object> model) { return transformInternal(template, sourceName, model, getModelAdaptor(), null); }
public synchronized String transform(String template, String sourceName, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, sourceName, model, getModelAdaptor(), processListener); }
public synchronized String transform(String template, Locale locale, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, locale, null, model, getModelAdaptor(), processListener); }
public synchronized String transform(String template, String sourceName, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, sourceName, model, getModelAdaptor(), processListener); }
public synchronized String transform(String template, String sourceName, Map<String, Object> model) { return transformInternal(template, sourceName, model, getModelAdaptor(), null); }
public synchronized String transform(String template, Map<String, Object> model) { return transformInternal(template, null, model, getModelAdaptor(), null); }
public synchronized String transform(String template, Locale locale, String sourceName, Map<String, Object> model) { return transformInternal(template, locale, sourceName, model, getModelAdaptor(), null); }
public synchronized String transform(String template, Map<String, Object> model) { return transformInternal(template, null, model, getModelAdaptor(), null); }
public synchronized String transform(String template, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, null, model, getModelAdaptor(), processListener); }
public synchronized String transform(String template, Locale locale, String sourceName, Map<String, Object> model) { return transformInternal(template, locale, sourceName, model, getModelAdaptor(), null); }
public synchronized String transform(String template, Locale locale, Map<String, Object> model) { return transformInternal(template, locale, null, model, getModelAdaptor(), null); }
public synchronized String transform(String template, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, null, model, getModelAdaptor(), processListener); }
/** * Transforms a template into an expanded output using the given model. * * @param template * the template to expand * @param locale * the locale being passed into renderers in * {@link TemplateContext} * @param sourceName * the name of the current template (if there is anything like * that) * @param model * the model used to evaluate expressions inside the template * @return the expanded output */ public synchronized String transform(String template, Locale locale, String sourceName, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, locale, sourceName, model, getModelAdaptor(), processListener); }
/** * Transforms a template into an expanded output using the given model. * * @param template * the template to expand * @param locale * the locale being passed into renderers in * {@link TemplateContext} * @param sourceName * the name of the current template (if there is anything like * that) * @param model * the model used to evaluate expressions inside the template * @return the expanded output */ public synchronized String transform(String template, Locale locale, String sourceName, Map<String, Object> model, ProcessListener processListener) { return transformInternal(template, locale, sourceName, model, getModelAdaptor(), processListener); }