Java Code Examples for freemarker.template.TemplateHashModelEx#keys()

The following examples show how to use freemarker.template.TemplateHashModelEx#keys() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LangFtlUtil.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
/**
 * Adds to simple hash from source map.
 * <p>
 * <em>WARN</em>: This is not BeanModel-aware (complex map).
 */
public static void addToSimpleMap(SimpleHash dest, TemplateHashModelEx source) throws TemplateModelException {
    TemplateCollectionModel keysModel = source.keys();
    TemplateModelIterator modelIt = keysModel.iterator();
    while(modelIt.hasNext()) {
        String key = getAsStringNonEscaping((TemplateScalarModel) modelIt.next());
        dest.put(key, source.get(key));
    }
}
 
Example 2
Source File: LangFtlUtil.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the still-wrapped TemplateModels in hash to a java Map.
 * <p>
 * <em>WARN</em>: This is not BeanModel-aware (complex map).
 */
public static void addModelsToMap(Map<String, ? super TemplateModel> dest, TemplateHashModelEx source) throws TemplateModelException {
    TemplateCollectionModel keysModel = source.keys();
    TemplateModelIterator modelIt = keysModel.iterator();
    while(modelIt.hasNext()) {
        String key = getAsStringNonEscaping((TemplateScalarModel) modelIt.next());
        dest.put(key, source.get(key));
    }
}