?? genericmanagerimpl.java
字號:
package com.mycompany.myapp.service.impl;
import java.io.Serializable;
import java.util.List;
import com.mycompany.myapp.dao.GenericDao;
import com.mycompany.myapp.service.GenericManager;
/**
* This class serves as the Base class for all other Managers - namely to hold
* common CRUD methods that they might all use. You should only need to extend
* this class when your require custom CRUD logic.
*
* @param <T> a type variable
* @param <PK> the primary key for that type
*/
public class GenericManagerImpl<T, PK extends Serializable> implements GenericManager<T, PK> {
/**
* GenericDao instance, set by constructor of this class
*/
protected GenericDao<T, PK> genericDao;
/* *//**
* Public constructor for creating a new GenericManagerImpl.
* @param genericDao the GenericDao to use for persistence
*/
public GenericManagerImpl(final GenericDao<T, PK> genericDao) {
this.genericDao = genericDao;
}
public void setGenericDao(GenericDao<T, PK> genericDao) {
this.genericDao = genericDao;
}
/**
* {@inheritDoc}
*/
public List<T> getAll() {
return genericDao.getAll();
}
/**
* {@inheritDoc}
*/
public T get(PK id) {
return genericDao.get(id);
}
/**
* {@inheritDoc}
*/
public T insert(T object) {
return genericDao.insert(object);
}
/**
* {@inheritDoc}
*/
public T update(T object) {
return genericDao.update(object);
}
/**
* {@inheritDoc}
*/
public void remove(PK id) {
genericDao.remove(id);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -