diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-04-15 17:57:58 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-04-15 17:57:58 +0200 |
commit | 08f161e0f370e91ee4e0cacbe3fec6c6bd9316cc (patch) | |
tree | 36798da57f99dab5449083b691361795ef9ddd49 /java/MyMyBatis/src/AbstractDAOOperations.java | |
parent | 5216c437a3aa95a22a603ff91126fb944b2da0a0 (diff) | |
download | share-08f161e0f370e91ee4e0cacbe3fec6c6bd9316cc.zip share-08f161e0f370e91ee4e0cacbe3fec6c6bd9316cc.tar.gz |
java : MyMyBatis goes functional interface
Diffstat (limited to 'java/MyMyBatis/src/AbstractDAOOperations.java')
-rw-r--r-- | java/MyMyBatis/src/AbstractDAOOperations.java | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/java/MyMyBatis/src/AbstractDAOOperations.java b/java/MyMyBatis/src/AbstractDAOOperations.java index e39f680..6fcd6e4 100644 --- a/java/MyMyBatis/src/AbstractDAOOperations.java +++ b/java/MyMyBatis/src/AbstractDAOOperations.java @@ -4,45 +4,34 @@ import java.util.List; public abstract class AbstractDAOOperations<TObject, TIdentity, TMapper extends AbstractMapper<TObject, TIdentity>> extends AbstractDAO<TObject, TMapper> { + public int insert(final TObject obj) { - return execInt(true, new CallBack<Integer, TMapper>() { - public Integer call(TMapper m) { return m.insert(obj); } - }); + return execInt(true, m -> m.insert(obj)); } public int update(final TObject obj) { - return execInt(true, new CallBack<Integer, TMapper>() { - public Integer call(TMapper m) { return m.update(obj); } - }); + return execInt(true, m -> m.update(obj)); } public int delete(final TObject obj) { - return execInt(true, new CallBack<Integer, TMapper>() { - public Integer call(TMapper m) { return m.delete(obj); } - }); + return execInt(true, m -> m.delete(obj)); } public int count() { - return execInt(false, new CallBack<Integer, TMapper>() { - public Integer call(TMapper m) { return m.count(); } - }); + return execInt(false, m -> m.count()); } public List<TObject> select() { - return execObjects(false, new CallBack<List<TObject>, TMapper>() { - public List<TObject> call(TMapper m) { return m.select(); } - }); + return execObjects(false, m -> m.select()); } public TObject selectOne(final TIdentity id) { - return execObject(false, new CallBack<TObject, TMapper>() { - public TObject call(TMapper m) { return m.selectOne(id); } - }); + return execObject(false, m -> m.selectOne(id)); } } |