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

us.codecraft.webmagic.samples.formatter.StringTemplateFormatter Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package us.codecraft.webmagic.samples.formatter;

import us.codecraft.webmagic.model.formatter.ObjectFormatter;

/**
 * @author [email protected]
 */
public class StringTemplateFormatter implements ObjectFormatter {

    private String template;

    @Override
    public String format(String raw) throws Exception {
        return String.format(template, raw);
    }

    @Override
    public Class clazz() {
        return String.class;
    }

    @Override
    public void initParam(String[] extra) {
        template = extra[0];
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy