public TemplateModel create(Object object, ObjectWrapper wrapper) { return new SimpleMapModel((Map) object, (BeansWrapper) wrapper); } };
@Override protected TemplateModel createModel(Class clazz) { Object[] obj = clazz.getEnumConstants(); if (obj == null) { // Return null - it'll manifest itself as undefined in the template. // We're doing this rather than throw an exception as this way // people can use someEnumModel?default({}) to gracefully fall back // to an empty hash if they want to. return null; } Map map = new LinkedHashMap(); for (int i = 0; i < obj.length; i++) { Enum value = (Enum) obj[i]; map.put(value.name(), value); } return new SimpleMapModel(map, getWrapper()); } }
public TemplateModel create(Object object, ObjectWrapper wrapper) { return new SimpleMapModel((Map) object, (BeansWrapper) wrapper); } };
public TemplateModel create(Object object, ObjectWrapper wrapper) { return new SimpleMapModel((Map)object, (BeansWrapper)wrapper); } };
public TemplateModel create(Object object, ObjectWrapper wrapper) { return new SimpleMapModel((Map) object, (BeansWrapper) wrapper); } };
@Override protected TemplateModel createModel(Class clazz) { Object[] obj = clazz.getEnumConstants(); if (obj == null) { // Return null - it'll manifest itself as undefined in the template. // We're doing this rather than throw an exception as this way // people can use someEnumModel?default({}) to gracefully fall back // to an empty hash if they want to. return null; } Map map = new LinkedHashMap(); for (int i = 0; i < obj.length; i++) { Enum value = (Enum) obj[i]; map.put(value.name(), value); } return new SimpleMapModel(map, getWrapper()); } }
protected TemplateModel createModel(Class clazz) { Object[] obj = clazz.getEnumConstants(); if(obj == null) { // Return null - it'll manifest itself as undefined in the template. // We're doing this rather than throw an exception as this way // people can use someEnumModel?default({}) to gracefully fall back // to an empty hash if they want to. return null; } Map map = new LinkedHashMap(); for (int i = 0; i < obj.length; i++) { Enum value = (Enum) obj[i]; map.put(value.name(), value); } return new SimpleMapModel(map, getWrapper()); } }
@Override protected TemplateModel createModel(Class clazz) { Object[] obj = clazz.getEnumConstants(); if (obj == null) { // Return null - it'll manifest itself as undefined in the template. // We're doing this rather than throw an exception as this way // people can use someEnumModel?default({}) to gracefully fall back // to an empty hash if they want to. return null; } Map map = new LinkedHashMap(); for (int i = 0; i < obj.length; i++) { Enum value = (Enum) obj[i]; map.put(value.name(), value); } return new SimpleMapModel(map, getWrapper()); } }
if (params instanceof Map) TemplateHashModel hashModel = new SimpleMapModel((Map)params, new DefaultObjectWrapper()); rootMap.put(key, hashModel); } else