Created
March 25, 2013 12:25
-
-
Save wsoczynski/5236774 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConcatPath implements Function<String,String> { | |
private final String subPath; | |
private ConcatPath(String subPath){ | |
this.subPath = subPath; | |
} | |
@Override | |
public String apply(String basePath){ | |
return FilenameUtils.concat(basePath,subPath); | |
} | |
public static ConcatPath with(String subPath){ | |
return new ConcatPath(subPath); | |
} | |
} | |
public class FileCreator implements Function<String, File> { | |
@Override | |
public File apply(String path){ | |
File result = new File(path); | |
return result; | |
} | |
} | |
public class FileExistanceChecker implements Predicate<File> { | |
@Override | |
public boolean apply(File input){ | |
return input.exists(); | |
} | |
} | |
public class File { | |
public static FileCreator createFromPath(){ | |
return new FileCreator(); | |
} | |
public static FileExistanceChecker ifExists(){ | |
return new FileExistanceChecker(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment