1 52 53 package freemarker.ext.beans; 54 55 import freemarker.ext.util.ModelFactory; 56 import freemarker.template.ObjectWrapper; 57 import freemarker.template.TemplateModel; 58 import freemarker.template.TemplateScalarModel; 59 60 67 public class StringModel extends BeanModel 68 implements TemplateScalarModel 69 { 70 static final ModelFactory FACTORY = 71 new ModelFactory() 72 { 73 public TemplateModel create(Object object, ObjectWrapper wrapper) 74 { 75 return new StringModel(object, (BeansWrapper)wrapper); 76 } 77 }; 78 79 88 public StringModel(Object object, BeansWrapper wrapper) 89 { 90 super(object, wrapper); 91 } 92 93 97 public String getAsString() 98 { 99 return object.toString(); 100 } 101 } 102 | Popular Tags |