Created
November 5, 2014 14:51
-
-
Save heat/1e79329d01587df09cc4 to your computer and use it in GitHub Desktop.
Exemplo de um repositorio de entidade pro java de uma entidade agregadora
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface EntityRepository<K, E> { | |
/* | |
* Para uma base de dados multi-clientes | |
*/ | |
public List<E> todos(Integer id); | |
public E busca(K key); | |
public K inserir(E entity); | |
public void atualizar(K key, E entity); | |
public void excluir(K key); | |
/* | |
* Quando uma entidade é um agregador ele | |
* retornara podera interar sobre uma "lista" dos elementos de sua | |
* responsabilidade | |
*/ | |
public ObjectRepository<KeyOject, ObjectElem> of(K key); | |
public static interface ObjectRepository<V, O> { | |
public V add(O object); | |
public void remove(K key); | |
public List<O> list(); | |
public O get(V k); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment