summaryrefslogtreecommitdiffstats
path: root/src/main/java/nu/xss/jpa/dao/Dao.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/nu/xss/jpa/dao/Dao.java')
-rw-r--r--src/main/java/nu/xss/jpa/dao/Dao.java175
1 files changed, 157 insertions, 18 deletions
diff --git a/src/main/java/nu/xss/jpa/dao/Dao.java b/src/main/java/nu/xss/jpa/dao/Dao.java
index 86444f4..c360667 100644
--- a/src/main/java/nu/xss/jpa/dao/Dao.java
+++ b/src/main/java/nu/xss/jpa/dao/Dao.java
@@ -1,3 +1,23 @@
+/**
+ * This file is part of xss-jpa.
+ *
+ * Copyright 2012 Sebastian Schmelzer
+ * http://xss.nu/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
package nu.xss.jpa.dao;
import java.util.List;
@@ -6,24 +26,143 @@ import nu.xss.jpa.query.Pagination;
import nu.xss.jpa.query.Sort;
import nu.xss.jpa.query.filter.Filter;
+/**
+ * The Interface Dao.
+ *
+ * @param <E>
+ * the element type
+ * @param <K>
+ * the key type
+ */
public interface Dao<E, K> {
- void save(E entity);
- void merge(E entity);
- void delete(E entity);
-
- E findById(K id);
-
- int count();
- int count(Filter... filter);
-
- List<E> findAll();
- List<E> findAll(Sort sort);
- List<E> findAll(Pagination pagination);
- List<E> findAll(Sort sort, Pagination pagination);
-
- List<E> findAll(Filter... filter);
- List<E> findAll(Sort sort, Filter... filter);
- List<E> findAll(Pagination pagination, Filter... filter);
- List<E> findAll(Sort sort, Pagination pagination, Filter... filter);
+
+ /**
+ * Save.
+ *
+ * @param entity
+ * the entity
+ */
+ void save(E entity);
+
+ /**
+ * Merge.
+ *
+ * @param entity
+ * the entity
+ */
+ void merge(E entity);
+
+ /**
+ * Delete.
+ *
+ * @param entity
+ * the entity
+ */
+ void delete(E entity);
+
+ /**
+ * Find by id.
+ *
+ * @param id
+ * the id
+ * @return the e
+ */
+ E findById(K id);
+
+ /**
+ * Count.
+ *
+ * @return the int
+ */
+ int count();
+
+ /**
+ * Count.
+ *
+ * @param filter
+ * the filter
+ * @return the int
+ */
+ int count(Filter... filter);
+
+ /**
+ * Find all.
+ *
+ * @return the list
+ */
+ List<E> findAll();
+
+ /**
+ * Find all.
+ *
+ * @param sort
+ * the sort
+ * @return the list
+ */
+ List<E> findAll(Sort sort);
+
+ /**
+ * Find all.
+ *
+ * @param pagination
+ * the pagination
+ * @return the list
+ */
+ List<E> findAll(Pagination pagination);
+
+ /**
+ * Find all.
+ *
+ * @param sort
+ * the sort
+ * @param pagination
+ * the pagination
+ * @return the list
+ */
+ List<E> findAll(Sort sort, Pagination pagination);
+
+ /**
+ * Find all.
+ *
+ * @param filter
+ * the filter
+ * @return the list
+ */
+ List<E> findAll(Filter... filter);
+
+ /**
+ * Find all.
+ *
+ * @param sort
+ * the sort
+ * @param filter
+ * the filter
+ * @return the list
+ */
+ List<E> findAll(Sort sort, Filter... filter);
+
+ /**
+ * Find all.
+ *
+ * @param pagination
+ * the pagination
+ * @param filter
+ * the filter
+ * @return the list
+ */
+ List<E> findAll(Pagination pagination, Filter... filter);
+
+ /**
+ * Find all.
+ *
+ * @param sort
+ * the sort
+ * @param pagination
+ * the pagination
+ * @param filter
+ * the filter
+ * @return the list
+ */
+ List<E> findAll(Sort sort, Pagination pagination, Filter... filter);
}