001package org.unix4j.unix.echo; 002 003import org.unix4j.unix.Echo; 004 005/** 006 * Factory for the {@link Echo echo} command returning 007 * a new command instance from every signature method. 008 */ 009public final class EchoFactory implements Echo.Interface<EchoCommand> { 010 011 /** 012 * The singleton instance of this factory. 013 */ 014 public static final EchoFactory INSTANCE = new EchoFactory(); 015 016 /** 017 * Private, only used to create singleton instance. 018 */ 019 private EchoFactory() { 020 super(); 021 } 022 023 @Override 024 public EchoCommand echo(String... args) { 025 final EchoArguments echoArgs = new EchoArguments(args); 026 return new EchoCommand(echoArgs); 027 } 028 029 @Override 030 public EchoCommand echo(EchoOptions options, String string) { 031 final EchoArguments echoArgs = new EchoArguments(options); 032 echoArgs.setString(string); 033 return new EchoCommand(echoArgs); 034 } 035 036 @Override 037 public EchoCommand echo(EchoOptions options, String... strings) { 038 final EchoArguments echoArgs = new EchoArguments(options); 039 echoArgs.setStrings(strings); 040 return new EchoCommand(echoArgs); 041 } 042}