T - public class InMemoryRepository<T extends Identifiable> extends java.lang.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(java.util.Collection<T> items)
Adds a collection of
Identifiables to the repository. |
java.util.List<T> |
findByField(java.lang.String fieldName,
java.lang.Object... values) |
T |
get(java.lang.String id)
Retrieves an
Identifiable from the repository according to an id or null in case no Identifiable
with the given id is not found |
java.util.List<T> |
getAll()
Obtains a list containing all the
Identifiables in the repository |
java.util.List<T> |
getAll(java.util.List<java.lang.String> ids) |
java.lang.Long |
getSize() |
T |
getUniqueInstance() |
java.lang.Boolean |
isEmpty() |
void |
remove(java.lang.String 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(java.util.Collection<T> items) |
void |
replaceAll(java.util.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.public void addAll(java.util.Collection<T> items)
RepositoryIdentifiables to the repository.addAll in interface Repository<T extends Identifiable>items - The Identifiables to add.public void update(T item)
RepositoryIdentifiable on the repository.update in interface Repository<T extends Identifiable>item - The Identifiable to update.public void remove(T item)
RepositoryIdentifiable from the repository.remove in interface Repository<T extends Identifiable>item - The Identifiable to removepublic void removeAll(java.util.Collection<T> items)
removeAll in interface Repository<T extends Identifiable>public void replaceAll(java.util.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.public java.util.List<T> getAll()
RepositoryIdentifiables in the repositorygetAll in interface Repository<T extends Identifiable>Identifiablespublic T get(java.lang.String 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.public void removeAll()
RepositoryIdentifiables that the repository has.removeAll in interface Repository<T extends Identifiable>public void remove(java.lang.String id)
RepositoryIdentifiable with the idremove in interface Repository<T extends Identifiable>id - The Identifiable id to be removedpublic java.lang.Boolean isEmpty()
isEmpty in interface Repository<T extends Identifiable>public java.lang.Long getSize()
getSize in interface Repository<T extends Identifiable>public java.util.List<T> findByField(java.lang.String fieldName, java.lang.Object... values)
findByField in interface Repository<T extends Identifiable>public java.util.List<T> getAll(java.util.List<java.lang.String> ids)
getAll in interface Repository<T extends Identifiable>public T getUniqueInstance()
getUniqueInstance in interface Repository<T extends Identifiable>