com.freenow.apis.phrase.api.format.JavaPropertiesFormat Maven / Gradle / Ivy
package com.freenow.apis.phrase.api.format;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
/**
* See https://phraseapp.com/docs/guides/formats/java-properties/
*/
public class JavaPropertiesFormat implements Format
{
private static final String NAME = "properties";
private final List options;
private JavaPropertiesFormat(List options)
{
this.options = options;
}
@Override
public String getName()
{
return NAME;
}
@Override
public List getOptions()
{
return options;
}
public static Builder newBuilder()
{
return new Builder();
}
public static class Builder
{
private final List options = new ArrayList<>();
public Builder setEscapeSingleQuotes(boolean escapeSingleQuotes)
{
return setOption("escape_single_quotes", "" + escapeSingleQuotes);
}
public Builder setOption(String name, String value)
{
String fullName = String.format("format_options[%s]", name);
options.add(new BasicNameValuePair(fullName, value));
return this;
}
public JavaPropertiesFormat build()
{
return new JavaPropertiesFormat(options);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy