diff options
author | Shawn O. Pearce <sop@google.com> | 2010-05-27 18:48:20 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2010-05-27 18:48:53 -0700 |
commit | 4af55273ee77971f5de6c7bdbdd9676aada7ac18 (patch) | |
tree | b85b92723ede2dee7fa171e4a8f4b8a69a045139 | |
parent | 24ddfbe9ebea3c25bbe3ca33889d91b1bcf2fda7 (diff) | |
download | gwtorm-4af55273ee77971f5de6c7bdbdd9676aada7ac18.tar.gz |
Simplify AbstractAccess API by removing indirection
When we removed Transaction support we lost the only reason for the
indirection here. Drop that indirect method and implement the
interface directly in the JdbcAccess subclass.
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | src/main/java/com/google/gwtorm/client/impl/AbstractAccess.java | 29 | ||||
-rw-r--r-- | src/main/java/com/google/gwtorm/jdbc/JdbcAccess.java | 10 |
2 files changed, 5 insertions, 34 deletions
diff --git a/src/main/java/com/google/gwtorm/client/impl/AbstractAccess.java b/src/main/java/com/google/gwtorm/client/impl/AbstractAccess.java index e192d30..77e150e 100644 --- a/src/main/java/com/google/gwtorm/client/impl/AbstractAccess.java +++ b/src/main/java/com/google/gwtorm/client/impl/AbstractAccess.java @@ -49,33 +49,4 @@ public abstract class AbstractAccess<E, K extends Key<?>> } } } - - public final void insert(final Iterable<E> instances) throws OrmException { - doInsert(instances); - } - - public final void update(final Iterable<E> instances) throws OrmException { - doUpdate(instances); - } - - public final void upsert(final Iterable<E> instances) throws OrmException { - doUpsert(instances); - } - - public final void delete(final Iterable<E> instances) throws OrmException { - doDelete(instances); - } - - protected abstract void doInsert(Iterable<E> instances) - throws OrmException; - - protected abstract void doUpdate(Iterable<E> instances) - throws OrmException; - - protected abstract void doUpsert(Iterable<E> instances) - throws OrmException; - - protected abstract void doDelete(Iterable<E> instances) - throws OrmException; - } diff --git a/src/main/java/com/google/gwtorm/jdbc/JdbcAccess.java b/src/main/java/com/google/gwtorm/jdbc/JdbcAccess.java index 351e825..08f18e2 100644 --- a/src/main/java/com/google/gwtorm/jdbc/JdbcAccess.java +++ b/src/main/java/com/google/gwtorm/jdbc/JdbcAccess.java @@ -154,7 +154,7 @@ public abstract class JdbcAccess<T, K extends Key<?>> extends } @Override - protected void doInsert(final Iterable<T> instances) throws OrmException { + public void insert(final Iterable<T> instances) throws OrmException { try { PreparedStatement ps = null; try { @@ -179,7 +179,7 @@ public abstract class JdbcAccess<T, K extends Key<?>> extends } @Override - protected void doUpdate(final Iterable<T> instances) throws OrmException { + public void update(final Iterable<T> instances) throws OrmException { try { PreparedStatement ps = null; try { @@ -204,7 +204,7 @@ public abstract class JdbcAccess<T, K extends Key<?>> extends } @Override - protected void doUpsert(final Iterable<T> instances) throws OrmException { + public void upsert(final Iterable<T> instances) throws OrmException { // Assume update first, it will cheaply tell us if the row is missing. // Collection<T> inserts = null; @@ -251,12 +251,12 @@ public abstract class JdbcAccess<T, K extends Key<?>> extends } if (inserts != null) { - doInsert(inserts); + insert(inserts); } } @Override - protected void doDelete(final Iterable<T> instances) throws OrmException { + public void delete(final Iterable<T> instances) throws OrmException { try { PreparedStatement ps = null; try { |