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

org.unix4j.unix.echo.EchoFactory Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
package org.unix4j.unix.echo;

import org.unix4j.unix.Echo;

/**
 * Factory for the {@link Echo echo} command returning 
 * a new command instance from every signature method.
 */
public final class EchoFactory implements Echo.Interface {
	
	/**
	 * The singleton instance of this factory.
	 */
	public static final EchoFactory INSTANCE = new EchoFactory();

	/**
	 * Private, only used to create singleton instance.
	 */
	private EchoFactory() {
		super();
	}

	@Override
	public EchoCommand echo(String... args) {
		final EchoArguments echoArgs = new EchoArguments(args);
		return new EchoCommand(echoArgs);
	}

	@Override
	public EchoCommand echo(EchoOptions options, String string) {
		final EchoArguments echoArgs = new EchoArguments(options);
		echoArgs.setString(string);
		return new EchoCommand(echoArgs);
	}

	@Override
	public EchoCommand echo(EchoOptions options, String... strings) {
		final EchoArguments echoArgs = new EchoArguments(options);
		echoArgs.setStrings(strings);
		return new EchoCommand(echoArgs);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy