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

notify.growl.AppleScriptBuilder Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
package notify.growl;

/**
 * Apple Script Fluent Builder
 * 
 * @author Tobias Södergren, Jayway
 * @author francois wauquier
 * 
 */
class AppleScriptBuilder {

	private StringBuilder builder = new StringBuilder();

	protected AppleScriptBuilder() {
		super();
	}

	public AppleScriptBuilder add(String text) {
		builder.append(text);
		return this;
	}

	public AppleScriptBuilder quote(String text) {
		builder.append("\"");
		builder.append(text);
		builder.append("\"");
		return this;
	}

	public AppleScriptBuilder nextRow(String text) {
		builder.append("\n");
		builder.append(text);
		return this;
	}

	public String get() {
		return builder.toString();
	}

	public AppleScriptBuilder array(String[] array) {
		builder.append("{");
		for (int i = 0; i < array.length; i++) {
			if (i > 0) {
				builder.append(", ");
			}
			quote(array[i]);
		}
		builder.append("}");
		return this;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy