Created
November 15, 2011 10:54
-
-
Save wulfgarpro/1366772 to your computer and use it in GitHub Desktop.
DAO pattern with Factory Method
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
public interface GenericDao<T, K> { | |
public K insert(T object); | |
} | |
public class GenericDaoMongoDBImpl<T, K> implements GenericDao<T, K> { | |
public K insert(T object) { | |
return null; | |
} | |
} | |
public interface ObjectDao extends GenericDao<Object, ObjectId> { | |
} | |
public class ObjectDaoMongoDBImpl extends GenericDaoMongoDBImpl<Object, ObjectId> implements ObjectDao { | |
} | |
public class DaoFactory { | |
public static GenericDao<Object, ObjectId> createDao() { | |
return new ObjectDaoMongoDBImpl(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment