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

com.smartling.maven.plugins.smartlingapi.mojo.Regex Maven / Gradle / Ivy

The newest version!
package com.smartling.maven.plugins.smartlingapi.mojo;

import org.apache.commons.lang3.StringUtils;

public class Regex extends NameTransformer
{
    private String pattern;
    private String replacement = StringUtils.EMPTY;

    public String getPattern()
    {
        return pattern;
    }

    public void setPattern(final String pattern)
    {
        this.pattern = pattern;
    }

    public String getReplacement()
    {
        return replacement;
    }

    public void setReplacement(final String replacement)
    {
        this.replacement = (null != replacement) ? replacement : StringUtils.EMPTY;
    }

    @Override
    public String transform(final String name, final String locale)
    {
        return name.replaceAll(injectLocale(pattern, locale), injectLocale(replacement, locale));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy