⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genericmanager.java

📁 对XML和DB的CURD的基本操作.使用的两个比较常用的组合设计模式:MVC模式+DAO模式。
💻 JAVA
字号:
package com.mycompany.myapp.service;import java.io.Serializable;import java.util.List;/** * Generic Manager that talks to GenericDao to CRUD POJOs. * * <p>Extend this interface if you want typesafe (no casting necessary) managers * for your domain objects. * * @param <T> a type variable * @param <PK> the primary key for that type */public interface GenericManager<T, PK extends Serializable> {    /**     * Generic method used to get all objects of a particular type. This     * is the same as lookup up all rows in a table.     * @return List of populated objects     */    List<T> getAll();        /**     * Generic method to get an object based on class and identifier. An     * ObjectRetrievalFailureException Runtime Exception is thrown if     * nothing is found.     *     * @param id the identifier (primary key) of the object to get     * @return a populated object     * @see org.springframework.orm.ObjectRetrievalFailureException     */    T get(PK id);    /**     * Generic method to insert an object.     * @param object the object to insert     * @return the persisted object     */    T insert(T object);        /**     * Generic method to update an object.     * @param object the object to update     * @return the persisted object     */    T update(T object);    /**     * Generic method to delete an object based on class and id     * @param id the identifier (primary key) of the object to remove     */    void remove(PK id);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -