T - public class InMemoryRepository<T extends Identifiable> extends Object implements Repository<T>
| Constructor and Description |
|---|
InMemoryRepository() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T item)
Adds an
Identifiable to the repository. |
void |
addAll(Collection<T> items)
Adds a collection of
Identifiables to the repository. |
List<T> |
findByField(String fieldName,
Object... values) |
T |
get(Long id)
Retrieves an
Identifiable from the repository according to an id or null in case no Identifiable
with the given id is not found |
List<T> |
getAll()
Obtains a list containing all the
Identifiables in the repository |
List<T> |
getAll(List<Long> ids) |
Long |
getSize() |
T |
getUniqueInstance() |
Boolean |
isEmpty() |
void |
remove(Long id)
Removes the
Identifiable with the id |
void |
remove(T item)
Removes an
Identifiable from the repository. |
void |
removeAll()
Removes all the
Identifiables that the repository has. |
void |
removeAll(Collection<T> items) |
void |
replaceAll(Collection<T> items)
Replaces all the
Identifiables in the repository by new ones. |
void |
update(T item)
Update an
Identifiable on the repository. |
public void add(T item)
RepositoryIdentifiable to the repository.add in interface Repository<T extends Identifiable>item - The Identifiable to add.Repository.add(com.jdroid.java.domain.Identifiable)public void addAll(Collection<T> items)
RepositoryIdentifiables to the repository.addAll in interface Repository<T extends Identifiable>items - The Identifiables to add.Repository.addAll(java.util.Collection)public void update(T item)
RepositoryIdentifiable on the repository.update in interface Repository<T extends Identifiable>item - The Identifiable to update.Repository.update(com.jdroid.java.domain.Identifiable)public void remove(T item)
RepositoryIdentifiable from the repository.remove in interface Repository<T extends Identifiable>item - The Identifiable to removeRepository.remove(com.jdroid.java.domain.Identifiable)public void removeAll(Collection<T> items)
removeAll in interface Repository<T extends Identifiable>Repository.removeAll(java.util.Collection)public void replaceAll(Collection<T> items)
RepositoryIdentifiables in the repository by new ones.replaceAll in interface Repository<T extends Identifiable>items - The new Identifiables to replace the old ones.Repository.replaceAll(java.util.Collection)public List<T> getAll()
RepositoryIdentifiables in the repositorygetAll in interface Repository<T extends Identifiable>IdentifiablesRepository.getAll()public T get(Long id)
RepositoryIdentifiable from the repository according to an id or null in case no Identifiable
with the given id is not foundget in interface Repository<T extends Identifiable>id - the id for the Identifiable to retrieveIdentifiable retrieved.Repository.get(java.lang.Long)public void removeAll()
RepositoryIdentifiables that the repository has.removeAll in interface Repository<T extends Identifiable>Repository.removeAll()public void remove(Long id)
RepositoryIdentifiable with the idremove in interface Repository<T extends Identifiable>id - The Identifiable id to be removedRepository.remove(java.lang.Long)public Boolean isEmpty()
isEmpty in interface Repository<T extends Identifiable>Repository.isEmpty()public Long getSize()
getSize in interface Repository<T extends Identifiable>Repository.getSize()public List<T> findByField(String fieldName, Object... values)
findByField in interface Repository<T extends Identifiable>Repository.findByField(java.lang.String, java.lang.Object[])public List<T> getAll(List<Long> ids)
getAll in interface Repository<T extends Identifiable>Repository.getAll(java.util.List)public T getUniqueInstance()
getUniqueInstance in interface Repository<T extends Identifiable>Repository.getUniqueInstance()Copyright © 2014. All rights reserved.