public TemplateModel getValue() throws TemplateModelException { return hash.get(((TemplateScalarModel) key).getAsString()); }
while (keys.hasNext()) { String key = (String) unwrap(keys.next(), nullModel, permissive); map.put(key, unwrap(hash.get(key), nullModel, permissive));
for (TemplateModelIterator it = keys.iterator(); it.hasNext();) { String prefix = ((TemplateScalarModel) it.next()).getAsString(); TemplateModel valueModel = prefixMap.get(prefix); if (!(valueModel instanceof TemplateScalarModel)) { {if (true) throw new ParseException("Non-string value in prefix to namespace hash.", exp);} for (TemplateModelIterator it = keys.iterator(); it.hasNext();) { String attName = ((TemplateScalarModel) it.next()).getAsString(); Object attValue = DeepUnwrap.unwrap(attributeMap.get(attName)); template.setCustomAttribute(attName, attValue);
while (it.hasNext()) { String key = TemplateModelUtils.converString(it.next()); nvps.add(new BasicNameValuePair(key, TemplateModelUtils.converString(parameters.get(key))));
while (it.hasNext()) { String key = TemplateModelUtils.converString(it.next()); nvps.add(new BasicNameValuePair(key, TemplateModelUtils.converString(parameters.get(key))));
loopVar, (TemplateHashModelEx) listedValue); loopVar2 = listedHash.get(((TemplateScalarModel) loopVar).getAsString()); hasNext = keysIter.hasNext(); try {
public TemplateModel getValue() throws TemplateModelException { return hash.get(((TemplateScalarModel) key).getAsString()); }
public TemplateModel getValue() throws TemplateModelException { return hash.get(((TemplateScalarModel) key).getAsString()); }
private Map getQueryParams(Map params) throws TemplateModelException { TemplateHashModelEx modelEx = (TemplateHashModelEx) params.get("query_params"); if(modelEx == null) return new HashMap(); TemplateCollectionModel keys = modelEx.keys(); TemplateModelIterator keysIt = keys.iterator(); Map queryParams = new HashMap(); while (keysIt.hasNext()) { TemplateModel key = keysIt.next(); queryParams.put(key.toString(), modelEx.get(key.toString()).toString()); } return queryParams; } }
/** * Convert a Freemarker TemplateObject to a usable map. * @throws TemplateModelException */ protected Map<? extends String, ? extends Object> toMap( Object hash ) throws TemplateModelException{ Map<String,Object> outMap = new HashMap<String,Object>(); if( hash instanceof TemplateHashModelEx ){ TemplateHashModelEx thme = (TemplateHashModelEx) hash; for( String key : junkToStrings( thme.keys() )){ outMap.put(key, thme.get(key)); } }else{ log.error("Freemarker is passing odd objects to method toMap(): " + hash.getClass().getName()); } return outMap; }
private Map<String, Object> getMapDump(TemplateHashModelEx model) throws TemplateModelException { Map<String, Object> map = new HashMap<String, Object>(); map.put(Key.TYPE.toString(), Type.HASH_EX); SortedMap<String, Object> items = new TreeMap<String, Object>(); TemplateCollectionModel keys = model.keys(); TemplateModelIterator iModel = keys.iterator(); while (iModel.hasNext()) { String key = iModel.next().toString(); // Work around this oddity: model.object does not contain // values for "empty" and "keys", but model.keys() does. if ("class".equals(key) || "empty".equals(key)) { continue; } TemplateModel value = model.get(key); // A map with exposed methods includes methods inherited from Map and Object like // size(), getClass(), etc. Punt on these for now by suppressing in the dump, // though this is not the optimal solution. If they are exposed to the templates, // the dump should also expose them. I'm guessing that in most cases these // methods are not relevant to template authors. if (! (value instanceof TemplateMethodModel)) { items.put(key, getDump(value)); } } map.put(Key.VALUE.toString(), items); return map; }
TemplateModel k = it.next(); String kk = k.toString(); TemplateModel v = t.get(kk); Object vv = null; if (v instanceof AdapterTemplateModel) {
dst.put(strkey, src.get(strkey));
while(keys.hasNext()) { String key = (String)unwrap(keys.next(), nullModel, permissive); map.put(key, unwrap(hash.get(key), nullModel, permissive));
String key = templateHashModelExKeyToString(iter.next()); map.put(key, hashEx.get(key));
while (keys.hasNext()) { String key = (String) unwrap(keys.next(), nullModel, permissive); map.put(key, unwrap(hash.get(key), nullModel, permissive));
while (keys.hasNext()) { String key = (String) unwrap(keys.next(), nullModel, permissive); map.put(key, unwrap(hash.get(key), nullModel, permissive));
String key = ((TemplateScalarModel) tit.next()) .getAsString(); res.put(key, ftlVarToCoreJavaObject(hash.get(key)));
loopVar, (TemplateHashModelEx) listedValue); loopVar2 = listedHash.get(((TemplateScalarModel) loopVar).getAsString()); hasNext = keysIter.hasNext(); try {
loopVar, (TemplateHashModelEx) listedValue); loopVar2 = listedHash.get(((TemplateScalarModel) loopVar).getAsString()); hasNext = keysIter.hasNext(); try {