001package org.unix4j.unix.head; 002 003import org.unix4j.unix.Head; 004 005/** 006 * Factory for the {@link Head head} command returning 007 * a new command instance from every signature method. 008 */ 009public final class HeadFactory implements Head.Interface<HeadCommand> { 010 011 /** 012 * The singleton instance of this factory. 013 */ 014 public static final HeadFactory INSTANCE = new HeadFactory(); 015 016 /** 017 * Private, only used to create singleton instance. 018 */ 019 private HeadFactory() { 020 super(); 021 } 022 023 @Override 024 public HeadCommand head() { 025 final HeadArguments headArgs = new HeadArguments(); 026 return new HeadCommand(headArgs); 027 } 028 029 @Override 030 public HeadCommand head(String... args) { 031 final HeadArguments headArgs = new HeadArguments(args); 032 return new HeadCommand(headArgs); 033 } 034 035 @Override 036 public HeadCommand head(long count) { 037 final HeadArguments headArgs = new HeadArguments(); 038 headArgs.setCount(count); 039 return new HeadCommand(headArgs); 040 } 041 042 @Override 043 public HeadCommand head(HeadOptions options, long count) { 044 final HeadArguments headArgs = new HeadArguments(options); 045 headArgs.setCount(count); 046 return new HeadCommand(headArgs); 047 } 048 049 @Override 050 public HeadCommand head(java.io.File... files) { 051 final HeadArguments headArgs = new HeadArguments(); 052 headArgs.setFiles(files); 053 return new HeadCommand(headArgs); 054 } 055 056 @Override 057 public HeadCommand head(long count, java.io.File... files) { 058 final HeadArguments headArgs = new HeadArguments(); 059 headArgs.setCount(count); 060 headArgs.setFiles(files); 061 return new HeadCommand(headArgs); 062 } 063 064 @Override 065 public HeadCommand head(long count, String... paths) { 066 final HeadArguments headArgs = new HeadArguments(); 067 headArgs.setCount(count); 068 headArgs.setPaths(paths); 069 return new HeadCommand(headArgs); 070 } 071 072 @Override 073 public HeadCommand head(HeadOptions options, long count, java.io.File... files) { 074 final HeadArguments headArgs = new HeadArguments(options); 075 headArgs.setCount(count); 076 headArgs.setFiles(files); 077 return new HeadCommand(headArgs); 078 } 079 080 @Override 081 public HeadCommand head(HeadOptions options, long count, String... paths) { 082 final HeadArguments headArgs = new HeadArguments(options); 083 headArgs.setCount(count); 084 headArgs.setPaths(paths); 085 return new HeadCommand(headArgs); 086 } 087}