Package com.aoindustries.dao
Interface Table<K extends Comparable<? super K>,R extends Row<K,?>>
-
- All Superinterfaces:
Collection<R>,Iterable<R>
public interface Table<K extends Comparable<? super K>,R extends Row<K,?>> extends Collection<R>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanadd(R e)default booleanaddAll(Collection<? extends R> c)default Kcanonicalize(K key)Gets the canonical key used for internal indexing.default voidclear()default voidclearCaches()Clears the caches for this table that apply to the current thread.default booleancontains(Object o)default booleancontainsAll(Collection<?> c)Rget(K key)Gets the row with the provided key.default Iterator<? extends R>getIterator()Iterates the rows in sorted order.Map<K,? extends R>getMap()Gets a map view of this table.ModelgetModel()Gets the model this table is part of.default StringgetName()Gets the table name.default Set<? extends R>getOrderedRows(Iterable<? extends K> keys)Gets an unmodifiable set of each object corresponding to the set of keys.SortedSet<? extends R>getRows()Gets all rows, sorted by their natural ordering.default SortedSet<? extends R>getRows(Iterable<? extends K> keys)Gets an unmodifiable sorted set of each object corresponding to the set of keys, sorted by their natural ordering.default intgetSize()Gets the number of accessible rows in this table.SortedMap<K,? extends R>getSortedMap()Gets a sorted map view of this table.Set<? extends R>getUnsortedRows()Gets all rows in no particular order.default booleanisEmpty()default Iterator<R>iterator()Iterates the rows in sorted order.default booleanremove(Object o)default booleanremoveAll(Collection<?> c)default booleanretainAll(Collection<?> c)default intsize()default voidtableUpdated()Called after the table is updated to ensure cache integrity.default Object[]toArray()default <T> T[]toArray(T[] a)-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream
-
-
-
-
Method Detail
-
getModel
Model getModel()
Gets the model this table is part of.
-
clearCaches
default void clearCaches()
Clears the caches for this table that apply to the current thread. This is used to end a caching session, generally short-term and associated with a single request or process. Any overriding method should call super.clearCaches().
-
tableUpdated
default void tableUpdated()
Called after the table is updated to ensure cache integrity. Cache coherency is maintained between users for global tables. For per-user caches only your own view is affected; no updates will be seen until the end of their caching transaction, generally a web request. Any overriding method should call super.tableUpdated().
-
clear
default void clear()
- Specified by:
clearin interfaceCollection<K extends Comparable<? super K>>
-
retainAll
default boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<K extends Comparable<? super K>>
-
removeAll
default boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<K extends Comparable<? super K>>
-
addAll
default boolean addAll(Collection<? extends R> c)
- Specified by:
addAllin interfaceCollection<K extends Comparable<? super K>>
-
containsAll
default boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<K extends Comparable<? super K>>
-
remove
default boolean remove(Object o)
- Specified by:
removein interfaceCollection<K extends Comparable<? super K>>
-
add
default boolean add(R e)
- Specified by:
addin interfaceCollection<K extends Comparable<? super K>>
-
toArray
default <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceCollection<K extends Comparable<? super K>>
-
toArray
default Object[] toArray()
- Specified by:
toArrayin interfaceCollection<K extends Comparable<? super K>>
-
contains
default boolean contains(Object o)
- Specified by:
containsin interfaceCollection<K extends Comparable<? super K>>
-
isEmpty
default boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<K extends Comparable<? super K>>
-
getSize
default int getSize() throws SQLExceptionGets the number of accessible rows in this table. This also provides JavaBeans-compatible size.- Throws:
SQLException
-
size
default int size()
- Specified by:
sizein interfaceCollection<K extends Comparable<? super K>>
-
getIterator
default Iterator<? extends R> getIterator() throws SQLException
Iterates the rows in sorted order. This also provides JavaBeans-compatible iterator.
-
iterator
default Iterator<R> iterator()
Iterates the rows in sorted order.- Specified by:
iteratorin interfaceCollection<K extends Comparable<? super K>>- Specified by:
iteratorin interfaceIterable<K extends Comparable<? super K>>- See Also:
getIterator()
-
getName
default String getName()
Gets the table name.
-
getUnsortedRows
Set<? extends R> getUnsortedRows() throws SQLException
Gets all rows in no particular order. This is an unmodifiable snapshot of the data and will not change over time. It may be iterated multiple times with the same results. The contents are not changed by the transactions of the current user or any other user.- Throws:
SQLException
-
getRows
SortedSet<? extends R> getRows() throws SQLException
Gets all rows, sorted by their natural ordering. This is an unmodifiable snapshot of the data and will not change over time. It may be iterated multiple times with the same results. The contents are not changed by the transactions of the current user or any other user.- Throws:
SQLException
-
canonicalize
default K canonicalize(K key)
Gets the canonical key used for internal indexing. In the case of case- insensitive matching, the key may have upper-case and lower-case matches, while the canonicalKey will convert to one format for matching. Any matches are performed on the canonical form the the query.
-
get
R get(K key) throws NoRowException, SQLException
Gets the row with the provided key.- Throws:
NoRowException- if not foundSQLException- if database error occurs
-
getOrderedRows
default Set<? extends R> getOrderedRows(Iterable<? extends K> keys) throws NoRowException, SQLException
Gets an unmodifiable set of each object corresponding to the set of keys. The elements will be in the set in the same order as the keys iterator. If a key is found twice, the element we be in the position of the first key. This is an unmodifiable snapshot of the data and will not change over time. It may be iterated multiple times with the same results. The contents are not changed by the transactions of the current user or any other user.- Throws:
NoRowException- if any key is not foundSQLException- if database error occurs
-
getRows
default SortedSet<? extends R> getRows(Iterable<? extends K> keys) throws NoRowException, SQLException
Gets an unmodifiable sorted set of each object corresponding to the set of keys, sorted by their natural ordering. This is an unmodifiable snapshot of the data and will not change over time. It may be iterated multiple times with the same results. The contents are not changed by the transactions of the current user or any other user.- Throws:
NoRowException- if any key is not foundSQLException- if database error occurs
-
-