001package org.unix4j.unix.cd; 002 003import org.unix4j.unix.Cd; 004 005/** 006 * Factory for the {@link Cd cd} command returning 007 * a new command instance from every signature method. 008 */ 009public final class CdFactory implements Cd.Interface<CdCommand> { 010 011 /** 012 * The singleton instance of this factory. 013 */ 014 public static final CdFactory INSTANCE = new CdFactory(); 015 016 /** 017 * Private, only used to create singleton instance. 018 */ 019 private CdFactory() { 020 super(); 021 } 022 023 @Override 024 public CdCommand cd() { 025 final CdArguments cdArgs = new CdArguments(); 026 return new CdCommand(cdArgs); 027 } 028 029 @Override 030 public CdCommand cd(java.io.File file) { 031 final CdArguments cdArgs = new CdArguments(); 032 cdArgs.setFile(file); 033 return new CdCommand(cdArgs); 034 } 035 036 @Override 037 public CdCommand cd(String path) { 038 final CdArguments cdArgs = new CdArguments(); 039 cdArgs.setPath(path); 040 return new CdCommand(cdArgs); 041 } 042}