All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.template.base.impl.DefaultExtensionStrategy Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.template.base.impl;

import org.zodiac.sdk.toolkit.util.AssertUtil;

/**
 * 假如未指定模板名后缀,则使用默认后缀。
 *
 */
public class DefaultExtensionStrategy implements TemplateSearchingStrategy {
    private final String defaultExtension;

    public DefaultExtensionStrategy(String defaultExtension) {
        this.defaultExtension = AssertUtil.assertNotNull(defaultExtension, "defaultExtension");
    }

    public Object getKey(String templateName) {
        return null;
    }

    public boolean findTemplate(TemplateMatcher matcher) {
        if (matcher.getExtension() == null) {
            matcher.setExtension(defaultExtension);
        }

        return matcher.findTemplate();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy