Created
February 2, 2015 03:25
-
-
Save dblevins/00cde6af51730dbcaf8e 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
import java.io.File; | |
import java.lang.annotation.Annotation; | |
public class FileConstraints { | |
{ | |
final Mapper mapper = new Mapper(); | |
mapper.map(Executable.class, File.class, File::canExecute); | |
mapper.map(Writable.class, File.class, File::canWrite); | |
mapper.map(Readable.class, File.class, File::canRead); | |
mapper.map(Directory.class, File.class, File::isDirectory); | |
mapper.map(Exists.class, File.class, File::exists); | |
} | |
public static class Mapper { | |
public <A extends Annotation, T> void map(Class<A> a, Class<T> type, Constraint<T> constraint) { | |
} | |
public <A extends Annotation, T> void map2(Class<A> a, Constraint<T> constraint) { | |
} | |
} | |
public interface Constraint <T> { | |
public boolean isValid(final T value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment