/** * Creates a template loader that will use the {@link Class#getResource(String)} * method of the specified class to load the resources, and <code>""</code> as base * path. This means that template paths will be resolved relatively to the class * location, that is, relatively to the directory (package) of the class. * * @param loaderClass the class whose * {@link Class#getResource(String)} will be used to load the templates. * * @deprecated it is confusing that the base path is <code>""</code>; * use {@link #ClassTemplateLoader(Class, String)} instead. */ public ClassTemplateLoader(Class loaderClass) { setFields(loaderClass, ""); }
setFields(loaderClass, path);
/** * Creates a template loader that will use the {@link Class#getResource(String)} * method of its own class to load the resources, and <code>"/"</code> as base path. * This means that that template paths will be resolved relatvively the root package * of the class hierarchy, so you hardly ever should use this constructor, rather do * something like this:<br> * {@link #ClassTemplateLoader(Class, String) * new ClassTemplateLoader(com.example.myapplication.SomeClass.class, "templates")} * * <p>If you extend this class, then the extending class will be used to load * the resources. * * <p>Warning: this constructor was malfunctioned prior FreeMarker 2.3.4 * -- please update FreeMarker if needed. * * @deprecated confusing constructor, and seldom useful; * use {@link #ClassTemplateLoader(Class, String)} instead. */ public ClassTemplateLoader() { setFields(this.getClass(), "/"); }