Package freemarker.ext.beans

Examples of freemarker.ext.beans.BeansWrapper.unwrap()


            if (value != null) {
                // the value should ALWAYS be a decendant of TemplateModel
                if (value instanceof TemplateModel) {
                    try {
                        map.put(entry.getKey(), objectWrapper
                            .unwrap((TemplateModel) value));
                    } catch (TemplateModelException e) {
                        LOG.error("failed to unwrap [" + value
                            + "] it will be ignored", e);
                    }
View Full Code Here


            if (value != null) {
                // the value should ALWAYS be a decendant of TemplateModel
                if (value instanceof TemplateModel) {
                    try {
                        map.put(entry.getKey(), objectWrapper.unwrap((TemplateModel) value));
                    } catch (TemplateModelException e) {
                        if (LOG.isErrorEnabled()) {
                            LOG.error("failed to unwrap [#0] it will be ignored", e, value.toString());
                        }
                    }
View Full Code Here

            }
            BeansWrapper bw = BeansWrapper.getDefaultInstance();
            for (int i=0; i<list.size(); i++) {
                Object elem = list.get(i);
                if (elem instanceof TemplateModel) {
                    elem = bw.unwrap((TemplateModel) elem);
                }
                result.add(elem);
            }
            unwrappedList = result;
        }
View Full Code Here

            ? (BeansWrapper)wrapper
            : BeansWrapper.getDefaultInstance();
        if(args != null && !args.isEmpty()) {
            Object[] aarg = new Object[1];
            for (Map.Entry<String, TemplateModel> entry: args.entrySet()) {
                Object arg = bwrapper.unwrap(entry.getValue());
                aarg[0] = arg;
                Method m = propertySetters.get(entry.getKey());
                if (m == null) {
                    if (dynaSetter == null) {
                        throw new TemplateModelException("Unknown property "
View Full Code Here

            for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
                Map.Entry entry = (Map.Entry) it.next();
                Object key = entry.getKey();
                Object value = entry.getValue();
                if (value instanceof TemplateModel) {
                    value = bw.unwrap((TemplateModel) value);
                }
                m.put(key, value);
            }
            unwrappedMap=m;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.